File tree Expand file tree Collapse file tree 2 files changed +21
-5
lines changed
Expand file tree Collapse file tree 2 files changed +21
-5
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import deleteActiveNoteModal from "./deleteActiveNoteModal";
55import { createClustersAndOrphansFolder } from "./createClustersAndOrphansFolder" ;
66import { puzzleTemplate } from "./templates" ;
77import type { clusterPluginSettings } from "main" ;
8+ import { stringify } from "querystring" ;
89
910const clusters = "CLUSTERS"
1011const 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}
Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments