Use for-of instead of forEach (#3583)
Co-authored-by: syuilo <syuilotan@yahoo.co.jp> Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com>
This commit is contained in:
parent
30c53e9ee0
commit
125849673a
84 changed files with 345 additions and 283 deletions
|
|
@ -36,9 +36,9 @@ export function applyTheme(theme: Theme, persisted = true) {
|
|||
|
||||
const props = compile(_theme);
|
||||
|
||||
Object.entries(props).forEach(([k, v]) => {
|
||||
for (const [k, v] of Object.entries(props)) {
|
||||
document.documentElement.style.setProperty(`--${k}`, v.toString());
|
||||
});
|
||||
}
|
||||
|
||||
if (persisted) {
|
||||
localStorage.setItem('theme', JSON.stringify(props));
|
||||
|
|
@ -74,10 +74,9 @@ function compile(theme: Theme): { [key: string]: string } {
|
|||
|
||||
const props = {};
|
||||
|
||||
Object.entries(theme.props).forEach(([k, v]) => {
|
||||
const c = getColor(v);
|
||||
props[k] = genValue(c);
|
||||
});
|
||||
for (const [k, v] of Object.entries(theme.props)) {
|
||||
props[k] = genValue(getColor(v));
|
||||
}
|
||||
|
||||
const primary = getColor(props['primary']);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue