aboutsummaryrefslogtreecommitdiff
path: root/src/background
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2020-05-04 17:04:50 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2020-05-04 17:24:18 +0900
commit4c873bb833ebe2264866f217ad1865965e66101d (patch)
tree434f1d7ea788bfb90a3dd66cfb4287ef40d1c888 /src/background
parent0a5d968f0e371294da1afe69421c67a309f19551 (diff)
Allow to change colorscheme property by set command
Diffstat (limited to 'src/background')
-rw-r--r--src/background/repositories/CachedSettingRepository.ts13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/background/repositories/CachedSettingRepository.ts b/src/background/repositories/CachedSettingRepository.ts
index e3d3950..b4cdd1c 100644
--- a/src/background/repositories/CachedSettingRepository.ts
+++ b/src/background/repositories/CachedSettingRepository.ts
@@ -1,6 +1,7 @@
import MemoryStorage from "../infrastructures/MemoryStorage";
import Settings from "../../shared/settings/Settings";
import Properties from "../../shared/settings/Properties";
+import ColorScheme from "../../shared/ColorScheme";
const CACHED_SETTING_KEY = "setting";
@@ -56,6 +57,18 @@ export class CachedSettingRepositoryImpl implements CachedSettingRepository {
case "complete":
current.properties.complete = newValue as string;
break;
+ case "colorscheme": {
+ switch (newValue) {
+ case ColorScheme.Light:
+ case ColorScheme.Dark:
+ case ColorScheme.System:
+ current.properties.colorscheme = newValue as ColorScheme;
+ break;
+ default:
+ throw new Error(`Unsupported colorscheme: ${newValue}`);
+ }
+ break;
+ }
}
await this.update(current);
}