Skip to content

Commit 19bc528

Browse files
author
Gusted
committed
Nice
1 parent 97b09ae commit 19bc528

2 files changed

Lines changed: 4 additions & 7 deletions

File tree

src/ui/popup/theme/controls/color-scheme.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ import {m} from 'malevic';
22
import {DropDown} from '../../../controls';
33
import ThemeControl from './theme-control';
44

5-
interface BgColorEditorProps {
5+
interface ColorSchemeDropDownProps {
66
selected: string;
77
values: string[];
88
onChange: (value: string) => void;
99
}
1010

11-
export default function ColorSchemeDropDown(props: BgColorEditorProps) {
11+
export default function ColorSchemeDropDown(props: ColorSchemeDropDownProps) {
1212
return (
1313
<ThemeControl label="Color Scheme">
1414
<DropDown

src/ui/popup/theme/page/index.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,13 @@ function ColorsGroup({theme, change}: ThemeGroupProps) {
4949
const isDarkScheme = theme.mode === 1;
5050
const bgProp: keyof Theme = isDarkScheme ? 'darkSchemeBackgroundColor' : 'lightSchemeBackgroundColor';
5151
const fgProp: keyof Theme = isDarkScheme ? 'darkSchemeTextColor' : 'lightSchemeTextColor';
52+
const csProp: keyof Theme = isDarkScheme ? 'darkColorScheme' : 'lightColorScheme';
5253
const defaultSchemeColors = isDarkScheme ? DEFAULT_COLORS.darkScheme : DEFAULT_COLORS.lightScheme;
5354
const colorSchemeValues: string[] = isDarkScheme ? DARK_COLOR_SCHEME.sort((a, b) => a.localeCompare(b)) : LIGHT_COLOR_SCHEME.sort((a, b) => a.localeCompare(b));
5455
const currentColorScheme = isDarkScheme ? theme.darkColorScheme : theme.lightColorScheme;
5556

5657
function onColorSchemeChange(newColor: string) {
57-
if (isDarkScheme) {
58-
change({darkColorScheme: newColor});
59-
} else {
60-
change({lightColorScheme: newColor});
61-
}
58+
change({[csProp]: newColor});
6259
change({[bgProp]: COLOR_SCHEMES[newColor].background});
6360
change({[fgProp]: COLOR_SCHEMES[newColor].text});
6461
}

0 commit comments

Comments
 (0)