File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -138,6 +138,22 @@ 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 )
148+ . getPropertyValue ( "--spice-dark" ) . trim ( ) === "#010101" ;
149+ toggleDark ( dark ) ;
150+ } , 100 ) ;
151+ }
152+ target [ property ] = value ;
153+ return true ;
154+ }
155+ } ) ;
156+
141157waitForElement ( [ ".main-actionButtons" ] , ( queries ) => {
142158 // Add activator on top bar
143159 const buttonContainer = queries [ 0 ] ;
You can’t perform that action at this time.
0 commit comments