diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2020-05-04 17:50:42 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-04 17:50:42 +0900 |
commit | 69b6894b1997a773678709a7cd591afddc15c8ce (patch) | |
tree | 07e4c665829236e733316ae6f2684fe03b0a6781 /src/shared/settings/Properties.ts | |
parent | 49addd75b76f185c9dad5d74e44e39cbea360510 (diff) | |
parent | 44ff8e449dba0de32500da3c3f17fc1361449717 (diff) |
Merge pull request #751 from ueokande/dark-mode
Supports dark mode
Diffstat (limited to 'src/shared/settings/Properties.ts')
-rw-r--r-- | src/shared/settings/Properties.ts | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/shared/settings/Properties.ts b/src/shared/settings/Properties.ts index cf10d61..7540c8a 100644 --- a/src/shared/settings/Properties.ts +++ b/src/shared/settings/Properties.ts @@ -1,20 +1,23 @@ +import ColorScheme from "../ColorScheme"; + export type PropertiesJSON = { hintchars?: string; smoothscroll?: boolean; complete?: string; + colorscheme?: ColorScheme; }; export type PropertyTypes = { hintchars: string; smoothscroll: string; complete: string; + colorscheme: string; }; -type PropertyName = "hintchars" | "smoothscroll" | "complete"; +type PropertyName = "hintchars" | "smoothscroll" | "complete" | "colorscheme"; type PropertyDef = { name: PropertyName; - description: string; defaultValue: string | number | boolean; type: "string" | "number" | "boolean"; }; @@ -22,28 +25,31 @@ type PropertyDef = { const defs: PropertyDef[] = [ { name: "hintchars", - description: "hint characters on follow mode", defaultValue: "abcdefghijklmnopqrstuvwxyz", type: "string", }, { name: "smoothscroll", - description: "smooth scroll", defaultValue: false, type: "boolean", }, { name: "complete", - description: "which are completed at the open page", defaultValue: "sbh", type: "string", }, + { + name: "colorscheme", + defaultValue: ColorScheme.System, + type: "string", + }, ]; const defaultValues = { hintchars: "abcdefghijklmnopqrstuvwxyz", smoothscroll: false, complete: "sbh", + colorscheme: ColorScheme.System, }; export default class Properties { @@ -53,18 +59,23 @@ export default class Properties { public complete: string; + public colorscheme: ColorScheme; + constructor({ hintchars, smoothscroll, complete, + colorscheme, }: { hintchars?: string; smoothscroll?: boolean; complete?: string; + colorscheme?: ColorScheme; } = {}) { this.hintchars = hintchars || defaultValues.hintchars; this.smoothscroll = smoothscroll || defaultValues.smoothscroll; this.complete = complete || defaultValues.complete; + this.colorscheme = colorscheme || defaultValues.colorscheme; } static fromJSON(json: PropertiesJSON): Properties { @@ -76,6 +87,7 @@ export default class Properties { hintchars: "string", smoothscroll: "boolean", complete: "string", + colorscheme: "string", }; } @@ -92,6 +104,7 @@ export default class Properties { hintchars: this.hintchars, smoothscroll: this.smoothscroll, complete: this.complete, + colorscheme: this.colorscheme, }; } } |