forked from FoundKeyGang/FoundKey
wip
This commit is contained in:
parent
2b07b3a873
commit
d2d3f7810e
3 changed files with 18 additions and 10 deletions
|
@ -6,7 +6,7 @@
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import { url, lang } from './config';
|
import { url, lang } from './config';
|
||||||
import applyTheme from './common/scripts/theme';
|
import applyTheme from './common/scripts/theme';
|
||||||
import darkTheme from '../theme/dark.json';
|
const darkTheme = require('../theme/dark');
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
computed: {
|
computed: {
|
||||||
|
|
|
@ -5,6 +5,8 @@ export default function(theme: { [key: string]: string }) {
|
||||||
if (k == 'meta') return;
|
if (k == 'meta') return;
|
||||||
document.documentElement.style.setProperty(`--${k}`, v.toString());
|
document.documentElement.style.setProperty(`--${k}`, v.toString());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
localStorage.setItem('theme', JSON.stringify(props));
|
||||||
}
|
}
|
||||||
|
|
||||||
function compile(theme: { [key: string]: string }): { [key: string]: string } {
|
function compile(theme: { [key: string]: string }): { [key: string]: string } {
|
||||||
|
@ -17,24 +19,24 @@ function compile(theme: { [key: string]: string }): { [key: string]: string } {
|
||||||
let m;
|
let m;
|
||||||
|
|
||||||
//#region #RGB
|
//#region #RGB
|
||||||
m = code.match(/^#([0-9a-f]{3})$/i)[1];
|
m = code.match(/^#([0-9a-f]{3})$/i);
|
||||||
if (m) {
|
if (m) {
|
||||||
return [
|
return [
|
||||||
parseInt(m.charAt(0), 16) * 0x11,
|
parseInt(m[1].charAt(0), 16) * 0x11,
|
||||||
parseInt(m.charAt(1), 16) * 0x11,
|
parseInt(m[1].charAt(1), 16) * 0x11,
|
||||||
parseInt(m.charAt(2), 16) * 0x11,
|
parseInt(m[1].charAt(2), 16) * 0x11,
|
||||||
255
|
255
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
//#region #RRGGBB
|
//#region #RRGGBB
|
||||||
m = code.match(/^#([0-9a-f]{6})$/i)[1];
|
m = code.match(/^#([0-9a-f]{6})$/i);
|
||||||
if (m) {
|
if (m) {
|
||||||
return [
|
return [
|
||||||
parseInt(m.substr(0, 2), 16),
|
parseInt(m[1].substr(0, 2), 16),
|
||||||
parseInt(m.substr(2, 2), 16),
|
parseInt(m[1].substr(2, 2), 16),
|
||||||
parseInt(m.substr(4, 2), 16),
|
parseInt(m[1].substr(4, 2), 16),
|
||||||
255
|
255
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,12 +8,18 @@ import VueRouter from 'vue-router';
|
||||||
import * as TreeView from 'vue-json-tree-view';
|
import * as TreeView from 'vue-json-tree-view';
|
||||||
import VAnimateCss from 'v-animate-css';
|
import VAnimateCss from 'v-animate-css';
|
||||||
import VModal from 'vue-js-modal';
|
import VModal from 'vue-js-modal';
|
||||||
import VueHotkey from './common/hotkey';
|
|
||||||
|
|
||||||
|
import VueHotkey from './common/hotkey';
|
||||||
import App from './app.vue';
|
import App from './app.vue';
|
||||||
import checkForUpdate from './common/scripts/check-for-update';
|
import checkForUpdate from './common/scripts/check-for-update';
|
||||||
import MiOS, { API } from './mios';
|
import MiOS, { API } from './mios';
|
||||||
import { version, codename, lang } from './config';
|
import { version, codename, lang } from './config';
|
||||||
|
import applyTheme from './common/scripts/theme';
|
||||||
|
const defaultTheme = require('../theme/light.json');
|
||||||
|
|
||||||
|
if (localStorage.getItem('theme') == null) {
|
||||||
|
applyTheme(defaultTheme);
|
||||||
|
}
|
||||||
|
|
||||||
Vue.use(Vuex);
|
Vue.use(Vuex);
|
||||||
Vue.use(VueRouter);
|
Vue.use(VueRouter);
|
||||||
|
|
Loading…
Reference in a new issue