aboutsummaryrefslogtreecommitdiff
path: root/src/shared/settings/Properties.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared/settings/Properties.ts')
-rw-r--r--src/shared/settings/Properties.ts24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/shared/settings/Properties.ts b/src/shared/settings/Properties.ts
index cf10d61..38f1d3b 100644
--- a/src/shared/settings/Properties.ts
+++ b/src/shared/settings/Properties.ts
@@ -1,16 +1,24 @@
+enum ColorScheme {
+ System = "system",
+ Light = "light",
+ Dark = "dark",
+}
+
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;
@@ -38,12 +46,19 @@ const defs: PropertyDef[] = [
defaultValue: "sbh",
type: "string",
},
+ {
+ name: "colorscheme",
+ description: "color scheme of the console",
+ defaultValue: ColorScheme.System,
+ type: "string",
+ },
];
const defaultValues = {
hintchars: "abcdefghijklmnopqrstuvwxyz",
smoothscroll: false,
complete: "sbh",
+ colorscheme: ColorScheme.System,
};
export default class Properties {
@@ -53,18 +68,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 +96,7 @@ export default class Properties {
hintchars: "string",
smoothscroll: "boolean",
complete: "string",
+ colorscheme: "string",
};
}
@@ -92,6 +113,7 @@ export default class Properties {
hintchars: this.hintchars,
smoothscroll: this.smoothscroll,
complete: this.complete,
+ colorscheme: this.colorscheme,
};
}
}