mirror of
https://akkoma.dev/AkkomaGang/akkoma-fe.git
synced 2024-11-08 09:29:10 +00:00
Merge pull request 'fix apply theme button without page refresh' (#309) from denys/akkoma-fe:fix-apply-theme into develop
Reviewed-on: https://akkoma.dev/AkkomaGang/akkoma-fe/pulls/309
This commit is contained in:
commit
9e4985e225
2 changed files with 15 additions and 7 deletions
|
@ -89,6 +89,10 @@
|
|||
margin: 1em 1em 0;
|
||||
}
|
||||
|
||||
.presets {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.tab-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
|
|
@ -7,14 +7,18 @@ export const applyTheme = (input) => {
|
|||
const body = document.body
|
||||
body.classList.add('hidden')
|
||||
|
||||
const styleEl = document.getElementById('theme-holder')
|
||||
const styleSheet = styleEl.sheet
|
||||
/** @type {CSSStyleSheet} */
|
||||
const styleSheet = document.getElementById('theme-holder').sheet
|
||||
|
||||
for (let i = styleSheet.cssRules.length; i--; ) {
|
||||
styleSheet.deleteRule(0)
|
||||
}
|
||||
|
||||
styleSheet.insertRule(
|
||||
`:root { ${rules.radii}; ${rules.colors}; ${rules.shadows}; ${rules.fonts}; }`,
|
||||
0
|
||||
)
|
||||
|
||||
styleSheet.toString()
|
||||
styleSheet.insertRule(`:root { ${rules.radii} }`, 'index-max')
|
||||
styleSheet.insertRule(`:root { ${rules.colors} }`, 'index-max')
|
||||
styleSheet.insertRule(`:root { ${rules.shadows} }`, 'index-max')
|
||||
styleSheet.insertRule(`:root { ${rules.fonts} }`, 'index-max')
|
||||
body.classList.remove('hidden')
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue