set disabled color

This commit is contained in:
Olivier Gagnon 2021-09-26 21:37:22 -04:00
parent b5abbbc240
commit d6584386ff
3 changed files with 18 additions and 1 deletions

@ -129,6 +129,7 @@ interface IDefaultSettings {
cha: string; cha: string;
int: string; int: string;
rep: string; rep: string;
disabled: string;
}; };
} }
@ -199,6 +200,7 @@ export const defaultSettings: IDefaultSettings = {
cha: "#a671d1", cha: "#a671d1",
int: "#6495ed", int: "#6495ed",
rep: "#faffdf", rep: "#faffdf",
disabled: "#66cfbc",
}, },
}; };
@ -258,6 +260,7 @@ export const Settings: ISettings & ISelfInitializer & ISelfLoading = {
cha: defaultSettings.theme.cha, cha: defaultSettings.theme.cha,
int: defaultSettings.theme.int, int: defaultSettings.theme.int,
rep: defaultSettings.theme.rep, rep: defaultSettings.theme.rep,
disabled: defaultSettings.theme.disabled,
}, },
init() { init() {
Object.assign(Settings, defaultSettings); Object.assign(Settings, defaultSettings);

@ -33,6 +33,7 @@ declare module "@mui/material/styles" {
let theme: Theme; let theme: Theme;
export function refreshTheme(): void { export function refreshTheme(): void {
console.log(Settings.theme.disabled);
theme = createTheme({ theme = createTheme({
colors: { colors: {
hp: Settings.theme.hp, hp: Settings.theme.hp,
@ -73,6 +74,10 @@ export function refreshTheme(): void {
default: Settings.theme.black, default: Settings.theme.black,
paper: Settings.theme.well, paper: Settings.theme.well,
}, },
action: {
disabledBackground: Settings.theme.disabled,
disabled: Settings.theme.disabled,
},
}, },
typography: { typography: {
fontFamily: "monospace", fontFamily: "monospace",

@ -22,7 +22,10 @@ interface IColorEditorProps {
} }
function ColorEditor({ name, onColorChange, color, defaultColor }: IColorEditorProps): React.ReactElement { function ColorEditor({ name, onColorChange, color, defaultColor }: IColorEditorProps): React.ReactElement {
if (color === undefined) throw new Error("should not happen"); if (color === undefined) {
console.error(`color ${name} was undefined, reverting to default`);
color = defaultColor;
}
return ( return (
<> <>
@ -264,6 +267,12 @@ export function ThemeEditorModal(props: IProps): React.ReactElement {
color={customTheme["rep"]} color={customTheme["rep"]}
defaultColor={defaultSettings.theme["rep"]} defaultColor={defaultSettings.theme["rep"]}
/> />
<ColorEditor
name="disabled"
onColorChange={onColorChange}
color={customTheme["disabled"]}
defaultColor={defaultSettings.theme["disabled"]}
/>
<br /> <br />
<br /> <br />
<TextField label={"import / export theme"} value={JSON.stringify(customTheme)} onChange={onThemeChange} /> <TextField label={"import / export theme"} value={JSON.stringify(customTheme)} onChange={onThemeChange} />