From 06e778390fb61b31d79deee8fdc49e02b6baa82e Mon Sep 17 00:00:00 2001 From: Huang Jing Date: Mon, 13 Nov 2023 22:04:26 +0800 Subject: [PATCH] fix: color picker --- src/Highlighter.ts | 4 +++- src/SettingsTab.ts | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Highlighter.ts b/src/Highlighter.ts index 6c1b703..a85e634 100644 --- a/src/Highlighter.ts +++ b/src/Highlighter.ts @@ -78,10 +78,12 @@ export const rerender = (settings: HighlightSettings) => { | 'idiomatic' )[] = ['basic', 'intermediate', 'advanced', 'specialized', 'idiomatic'] + console.log(settings) + for (let i = 0; i < levels.length; i++) { // set background color document.documentElement.style.setProperty( - `--vocab-hl-${levels[i+1]}`, + `--vocab-hl-${levels[i]}`, settings[levels[i]].bg, ) diff --git a/src/SettingsTab.ts b/src/SettingsTab.ts index c975ce3..81ddf45 100644 --- a/src/SettingsTab.ts +++ b/src/SettingsTab.ts @@ -45,8 +45,9 @@ export default class HighlistSettingsTab extends PluginSettingTab { picker.onChange(() => { const { r, g, b } = picker.getValueRgb() + let s = getSettings() updateSettings({ - [category]: { ...[category], bg: `${r}, ${g}, ${b}` }, + [category]: { ...s[category], bg: `${r}, ${g}, ${b}` }, }) this.plugin.saveSettings() })