File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -138,6 +138,21 @@ function toggleDark(setDark) {
138138/* Init with light/dark mode from settings */
139139toggleDark ( settingsDark ) ;
140140
141+ /* Hook user changes to toggle using a proxy for Spicetify.Config */
142+ Spicetify . Config = new Proxy ( Spicetify . Config , {
143+ set ( target , property , value ) {
144+ if ( property === "color_scheme" ) {
145+ // Wait 100ms for CSS variables to update
146+ setTimeout ( ( ) => {
147+ let dark = getComputedStyle ( document . documentElement ) . getPropertyValue ( "--spice-dark" ) . trim ( ) === "#010101" ;
148+ toggleDark ( dark ) ;
149+ } , 100 ) ;
150+ }
151+ target [ property ] = value ;
152+ return true ;
153+ }
154+ } ) ;
155+
141156waitForElement ( [ ".main-actionButtons" ] , ( queries ) => {
142157 // Add activator on top bar
143158 const buttonContainer = queries [ 0 ] ;
You can’t perform that action at this time.
0 commit comments