-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcustomTheme.js
More file actions
60 lines (54 loc) · 2.25 KB
/
Copy pathcustomTheme.js
File metadata and controls
60 lines (54 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
const config = require('./config.json');
module.exports = (FCADE) => { runPlugin(FCADE) };
const defaultGeneralConfig = {
"--errorColor": "#ff0031",
"--patreonUserColor": "#f5b50e",
"--devUserColor": "#f5b50e",
"--state-online": "#59b240",
"--state-away": "#ef9f00"
}
const defaultWindowConfig = {
"--mainColor": "#351b30",
"--accentColor": "#33f1e5",
"--accentColor2": "#ff007a",
"--mainColor-light": "#5e3550",
"--mainColor-dark": "#260f23",
"--mainColor-lighter": "#854b71",
"--mainColor-lightest": "#d8bace",
"--mainColor-darker": "#140812",
"--mainColor-lightest-trans-hi": "rgba(216,186,206,.7)",
"--mainColor-lightest-trans-md": "rgba(216,186,206,.5)",
"--mainColor-dark-trans-lo": "rgba(38,15,35,.3)",
"--mainColor-darker-trans-hi": "rgba(20,8,18,.7)",
"--mainColor-darker-trans-lo": "rgba(20,8,18,.3)"
}
const runPlugin = (FCADE) => {
applyCustomColors(FCADE, config.customThemeGeneralConfig, config.customThemeWindowConfig);
}
const applyCustomColors = (FCADE, customThemeGeneralConfig, customThemeWindowConfig) => {
if (!customThemeGeneralConfig) {
console.log("Can't load custom general theme config! Defaulting")
customThemeGeneralConfig = defaultGeneralConfig
}
if (!customThemeWindowConfig) {
console.log("Can't load custom window theme config! Defaulting")
customThemeWindowConfig = defaultWindowConfig
}
console.log(customThemeGeneralConfig)
console.log(customThemeWindowConfig)
//Fightcade uses two stylesheets, so pick the first one
const stylesheet = document.styleSheets[0];
//There are way too many rules, so choose index 92 for general colors and 93 for window colors
const generalColors = stylesheet.cssRules[92].style;
const windowColors = stylesheet.cssRules[93].style;
Object.entries(customThemeGeneralConfig).forEach(color => {
const [key, value] = color;
generalColors.setProperty(key, value);
});
console.log("Applied general colors for custom theme.")
Object.entries(customThemeWindowConfig).forEach(color => {
const [key, value] = color;
windowColors.setProperty(key, value);
});
console.log("Applied window colors for custom theme.")
}