Skip to content

Commit 2ec79e5

Browse files
fix card style for light theme
1 parent f9e0e07 commit 2ec79e5

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

src/createFamily/buttons.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import deleteActiveNoteModal from "./deleteActiveNoteModal";
55
import { createClustersAndOrphansFolder } from "./createClustersAndOrphansFolder";
66
import { puzzleTemplate } from "./templates";
77
import type { clusterPluginSettings } from "main";
8+
import { stringify } from "querystring";
89

910
const clusters = "CLUSTERS"
1011
const orphans = "ORPHANS"
@@ -283,10 +284,19 @@ export async function cardStyleFunction(settings: clusterPluginSettings){
283284
setTimeout(() => {
284285

285286
const appContainer = document.body
287+
const classList = Array.from(appContainer.classList)
288+
const isDark = classList.find((className : string) => className ==="theme-dark" )
289+
290+
console.log("classList:", classList);
286291
if(settings.cardStyle){
287-
appContainer.classList.add("card-layout-open-dark")
292+
if(isDark){
293+
294+
appContainer.classList.add("card-layout-open-dark")
295+
}
296+
appContainer.classList.add("card-layout-open-light")
288297
}else{
289298
appContainer.classList.remove("card-layout-open-dark")
299+
appContainer.classList.remove("card-layout-open-light")
290300
}
291301
}, 500);
292302
}

src/createFamily/settings.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,19 +61,25 @@ export class settingTab extends PluginSettingTab {
6161
const cardStyle = new Setting(containerEl);
6262
cardStyle.setName("Card Style");
6363
cardStyle.setDesc(
64-
"If you are using 'Lorens' theme this option will add card style on PC.",
64+
"If you are using 'Lorens' theme on PC this option will add card style .",
6565
);
6666
cardStyle.addToggle((toggle: ToggleComponent) => {
6767
toggle.setValue(this.plugin.settings.cardStyle);
6868
toggle.onChange(async (value) => {
6969
this.plugin.settings.cardStyle = value;
70-
const appContainer = document.body
70+
const appContainer = document.body
71+
const classList = Array.from(appContainer.classList)
72+
const isDark = classList.find((className : string) => className ==="theme-dark" )
7173
if(value){
7274
await this.plugin.saveSettings();
73-
appContainer.classList.add("card-layout-open-dark")
74-
console.log(this.plugin.settings.cardStyle)
75+
if(isDark){
76+
77+
appContainer.classList.add("card-layout-open-dark")
78+
}
79+
appContainer.classList.add("card-layout-open-light")
7580
}else{
7681
appContainer.classList.remove("card-layout-open-dark")
82+
appContainer.classList.remove("card-layout-open-light")
7783
await this.plugin.saveSettings();
7884

7985
}

0 commit comments

Comments
 (0)