Skip to content

Commit ca5d2ca

Browse files
authored
Merge pull request #1023 from jprochazk/auto-dark-mode
Add dark mode
2 parents 606c93c + e990fe7 commit ca5d2ca

24 files changed

+344
-51
lines changed

ui/frontend/.stylelintrc.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
"ignoreProperties": [
1313
"composes"
1414
]
15+
}],
16+
"at-rule-no-unknown": [true, {
17+
"ignoreAtRules": ["define-mixin", "mixin"]
1518
}]
1619
}
1720
}

ui/frontend/BuildMenu.module.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
.code {
2-
background: #eee;
2+
background: var(--code-background-color);
33
padding: 0 0.25em;
44
}

ui/frontend/ButtonSet.module.css

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,7 @@ $radius: 4px;
7676

7777
.secondary {
7878
composes: -border -button;
79-
background: linear-gradient(
80-
to bottom,
81-
var(--button-secondary-bg-color-top),
82-
var(--button-secondary-bg-color-bottom)
83-
);
79+
background: var(--button-secondary-bg-color);
8480
border-color: var(--button-secondary-border-color);
8581
color: var(--button-secondary-color);
8682

@@ -122,3 +118,8 @@ $radius: 4px;
122118
aspect-ratio: 1/1;
123119
justify-items: center;
124120
}
121+
122+
a.iconLink svg,
123+
a.iconLink:visited svg {
124+
fill: var(--font-color) !important;
125+
}

ui/frontend/ButtonSet.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ IconButton.displayName = 'IconButton';
7979

8080
export const IconLink = React.forwardRef<HTMLAnchorElement, LinkProps>(
8181
({ children, ...props }, ref) => (
82-
<Link ref={ref} className={styles.icon} {...props}>
82+
<Link ref={ref} className={`${styles.icon} ${styles.iconLink}`} {...props}>
8383
{children}
8484
</Link>
8585
),

ui/frontend/ConfigElement.module.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@
2020

2121
.select {
2222
width: 100%;
23+
background: var(--button-secondary-bg-color);
24+
border-color: var(--button-secondary-border-color);
25+
color: var(--button-secondary-color);
26+
27+
& option {
28+
background-color: var(--button-secondary-bg-color-top);
29+
border-color: var(--button-secondary-border-color);
30+
color: var(--button-secondary-color);
31+
}
2332
}
2433

2534
.toggle {

ui/frontend/ConfigMenu.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ import {
1414
Orientation,
1515
PairCharacters,
1616
ProcessAssembly,
17+
Theme,
1718
} from './types';
19+
import { showThemeSelector } from './selectors';
1820

1921
const MONACO_THEMES = [
2022
'vs', 'vs-dark', 'vscode-dark-plus',
@@ -24,17 +26,21 @@ const ConfigMenu: React.FC = () => {
2426
const keybinding = useAppSelector((state) => state.configuration.ace.keybinding);
2527
const aceTheme = useAppSelector((state) => state.configuration.ace.theme);
2628
const monacoTheme = useAppSelector((state) => state.configuration.monaco.theme);
29+
const theme = useAppSelector((state) => state.configuration.theme);
2730
const orientation = useAppSelector((state) => state.configuration.orientation);
2831
const editorStyle = useAppSelector((state) => state.configuration.editor);
2932
const pairCharacters = useAppSelector((state) => state.configuration.ace.pairCharacters);
3033
const assemblyFlavor = useAppSelector((state) => state.configuration.assemblyFlavor);
3134
const demangleAssembly = useAppSelector((state) => state.configuration.demangleAssembly);
3235
const processAssembly = useAppSelector((state) => state.configuration.processAssembly);
3336

37+
const showTheme = useAppSelector(showThemeSelector);
38+
3439
const dispatch = useAppDispatch();
3540
const changeAceTheme = useCallback((t: string) => dispatch(config.changeAceTheme(t)), [dispatch]);
3641
const changeMonacoTheme = useCallback((t: string) => dispatch(config.changeMonacoTheme(t)), [dispatch]);
3742
const changeKeybinding = useCallback((k: string) => dispatch(config.changeKeybinding(k)), [dispatch]);
43+
const changeTheme = useCallback((t: Theme) => dispatch(config.changeTheme(t)), [dispatch]);
3844
const changeOrientation = useCallback((o: Orientation) => dispatch(config.changeOrientation(o)), [dispatch]);
3945
const changeEditorStyle = useCallback((e: Editor) => dispatch(config.changeEditor(e)), [dispatch]);
4046
const changeAssemblyFlavor =
@@ -98,6 +104,13 @@ const ConfigMenu: React.FC = () => {
98104
</MenuGroup>
99105

100106
<MenuGroup title="UI">
107+
{showTheme && (
108+
<SelectConfig name="Theme" value={theme} onChange={changeTheme}>
109+
{ /* <option value={Theme.System}>System</option> */ }
110+
<option value={Theme.Light}>Light</option>
111+
<option value={Theme.Dark}>Dark</option>
112+
</SelectConfig>
113+
)}
101114
<SelectConfig
102115
name="Orientation"
103116
value={orientation}

ui/frontend/Help.module.css

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
.container {
22
margin: 1em auto;
3-
background-color: #fff;
3+
color: var(--font-color-high-contrast);
4+
background-color: var(--background-color-high-contrast);
45
padding: 1em;
56
max-width: 800px;
67
line-height: 1.5;
78
}
89

910
.code {
10-
background: #eee;
11+
background: var(--code-background-color);
1112
padding: 0 0.25em;
1213
}
1314

@@ -22,7 +23,7 @@
2223
}
2324

2425
.headerLink {
25-
color: black;
26+
color: var(--header-link-color);
2627
text-decoration: none;
2728

2829
&:hover {

ui/frontend/Notifications.module.css

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ $space: 0.25em;
1010
margin-right: auto;
1111
margin-left: auto;
1212
border: 2px solid #428bca;
13-
background: white;
13+
background: var(--background-color);
1414
max-width: 50em;
1515
}
1616

@@ -25,7 +25,6 @@ $space: 0.25em;
2525
.close {
2626
composes: -buttonReset from './shared.module.css';
2727
cursor: pointer;
28-
background: #e1e1db;
2928
padding: $space;
3029
}
3130

ui/frontend/Output.module.css

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
$current-tab: #f9ffff;
2-
$background-tab: #fcfcfc; /* desaturate($current-tab, 100%); */
3-
41
.container {
52
display: flex;
63
flex-direction: column;
@@ -13,11 +10,12 @@ $background-tab: #fcfcfc; /* desaturate($current-tab, 100%); */
1310
}
1411

1512
.tab {
13+
color: var(--font-color);
1614
flex: 1 1 auto;
1715
cursor: pointer;
1816
border: var(--border);
1917
border-right: none;
20-
background-color: $background-tab;
18+
background-color: var(--output-background-tab);
2119
line-height: 1.5em;
2220

2321
&:last-of-type {
@@ -29,7 +27,7 @@ $background-tab: #fcfcfc; /* desaturate($current-tab, 100%); */
2927
composes: tab;
3028
cursor: default;
3129
border-bottom: none;
32-
background-color: $current-tab;
30+
background-color: var(--output-current-tab);
3331

3432
&:focus {
3533
outline: none;
@@ -44,7 +42,7 @@ $background-tab: #fcfcfc; /* desaturate($current-tab, 100%); */
4442
.body {
4543
border: var(--border);
4644
border-top: none;
47-
background-color: $current-tab;
45+
background-color: var(--output-current-tab);
4846
padding: 0.5em;
4947
height: 100%;
5048
overflow: scroll;

ui/frontend/Output/Header.module.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.container {
22
display: flex;
3-
color: var(--border-color);
3+
color: var(--font-color);
44
white-space: nowrap;
55

66
&::before,

0 commit comments

Comments
 (0)