File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,13 +2,13 @@ import {m} from 'malevic';
22import { DropDown } from '../../../controls' ;
33import 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
Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments