mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-12-09 12:56:07 +08:00
preset and custom work harmoniously
This commit is contained in:
parent
ddf9159bef
commit
14973390f7
1 changed files with 16 additions and 0 deletions
|
|
@ -443,6 +443,20 @@ $(document).on("click",".pageSettings .section.tags .tagsList .tag .removeButton
|
|||
})
|
||||
|
||||
//theme tabs & custom theme
|
||||
const colorVars = ['--bg-color', '--main-color','--caret-color', '--sub-color', '--text-color', '--error-color', '--error-extra-color']
|
||||
|
||||
function presetColor() {
|
||||
colorVars.forEach(e => {
|
||||
document.documentElement.style.setProperty(e, '')
|
||||
});
|
||||
}
|
||||
|
||||
function customColor() {
|
||||
colorVars.forEach(e => {
|
||||
document.documentElement.style.setProperty(e, 'inherit')
|
||||
});
|
||||
}
|
||||
|
||||
$(".tab").click(e => {
|
||||
$('.tab').removeClass("active")
|
||||
var $target = $(e.currentTarget)
|
||||
|
|
@ -450,11 +464,13 @@ $(".tab").click(e => {
|
|||
|
||||
if($target.attr("tab") == "preset") {
|
||||
$('[tabContent="custom"]').removeClass("reveal")
|
||||
presetColor()
|
||||
setTimeout(() => {
|
||||
$('[tabContent="preset"]').addClass("reveal")
|
||||
}, 250);
|
||||
} else {
|
||||
$('[tabContent="preset"]').removeClass("reveal")
|
||||
customColor();
|
||||
setTimeout(() => {
|
||||
$('[tabContent="custom"]').addClass("reveal")
|
||||
}, 250);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue