summaryrefslogtreecommitdiff
path: root/src/client/app/common/scripts
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-09-26 19:14:11 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-09-26 19:14:11 +0900
commitd2d3f7810eaa319fa562377436ad6c70e4736c06 (patch)
tree96fad75d3b6827c43562761133d5309dbba68d88 /src/client/app/common/scripts
parentwip (diff)
downloadmisskey-d2d3f7810eaa319fa562377436ad6c70e4736c06.tar.gz
misskey-d2d3f7810eaa319fa562377436ad6c70e4736c06.tar.bz2
misskey-d2d3f7810eaa319fa562377436ad6c70e4736c06.zip
wip
Diffstat (limited to 'src/client/app/common/scripts')
-rw-r--r--src/client/app/common/scripts/theme.ts18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/client/app/common/scripts/theme.ts b/src/client/app/common/scripts/theme.ts
index bc70223519..7fbac7f574 100644
--- a/src/client/app/common/scripts/theme.ts
+++ b/src/client/app/common/scripts/theme.ts
@@ -5,6 +5,8 @@ export default function(theme: { [key: string]: string }) {
if (k == 'meta') return;
document.documentElement.style.setProperty(`--${k}`, v.toString());
});
+
+ localStorage.setItem('theme', JSON.stringify(props));
}
function compile(theme: { [key: string]: string }): { [key: string]: string } {
@@ -17,24 +19,24 @@ function compile(theme: { [key: string]: string }): { [key: string]: string } {
let m;
//#region #RGB
- m = code.match(/^#([0-9a-f]{3})$/i)[1];
+ m = code.match(/^#([0-9a-f]{3})$/i);
if (m) {
return [
- parseInt(m.charAt(0), 16) * 0x11,
- parseInt(m.charAt(1), 16) * 0x11,
- parseInt(m.charAt(2), 16) * 0x11,
+ parseInt(m[1].charAt(0), 16) * 0x11,
+ parseInt(m[1].charAt(1), 16) * 0x11,
+ parseInt(m[1].charAt(2), 16) * 0x11,
255
];
}
//#endregion
//#region #RRGGBB
- m = code.match(/^#([0-9a-f]{6})$/i)[1];
+ m = code.match(/^#([0-9a-f]{6})$/i);
if (m) {
return [
- parseInt(m.substr(0, 2), 16),
- parseInt(m.substr(2, 2), 16),
- parseInt(m.substr(4, 2), 16),
+ parseInt(m[1].substr(0, 2), 16),
+ parseInt(m[1].substr(2, 2), 16),
+ parseInt(m[1].substr(4, 2), 16),
255
];
}