12
12
}
13
13
14
14
// Accent colors
15
- const accents = [ 'none' , 'rosewater' , 'flamingo' , 'pink' , 'maroon' , 'red' , 'peach' , 'yellow' , 'green' , 'teal' , 'sapphire' , 'blue' , 'sky' , 'mauve' , 'lavender' ] ;
15
+ const accents = [
16
+ "none" ,
17
+ "rosewater" ,
18
+ "flamingo" ,
19
+ "pink" ,
20
+ "maroon" ,
21
+ "red" ,
22
+ "peach" ,
23
+ "yellow" ,
24
+ "green" ,
25
+ "teal" ,
26
+ "sapphire" ,
27
+ "blue" ,
28
+ "sky" ,
29
+ "mauve" ,
30
+ "lavender" ,
31
+ ] ;
16
32
17
33
// Create our own section matching spotifys style and structure
18
34
const Section = Spicetify . React . memo ( ( ) => {
19
35
const colorScheme = Spicetify . Config . color_scheme || "frappe" ;
20
- const initialValue = localStorage . getItem ( 'catppuccin-accentColor' ) ?? 'none' ;
21
- const [ selectedValue , setSelectedValue ] = Spicetify . React . useState ( initialValue ) ;
36
+ const initialValue =
37
+ localStorage . getItem ( "catppuccin-accentColor" ) ?? "none" ;
38
+ const [ selectedValue , setSelectedValue ] =
39
+ Spicetify . React . useState ( initialValue ) ;
22
40
23
41
Spicetify . React . useEffect ( ( ) => {
24
42
const accent = selectedValue === "none" ? "text" : selectedValue ;
25
43
const properties = {
26
44
"--spice-text" : `var(--spice-${ selectedValue } )` ,
27
45
"--spice-button-active" : `var(--spice-${ selectedValue } )` ,
28
- "--spice-equalizer" : document . querySelector ( "body > script.marketplaceScript" ) ? `url('https://github.com/catppuccin/spicetify/blob/main/catppuccin/assets/${ colorScheme } /equalizer-animated-${ accent } .gif?raw=true')` : `url('${ colorScheme } /equalizer-animated-${ accent } .gif')`
46
+ "--spice-equalizer" : document . querySelector (
47
+ "body > script.marketplaceScript" ,
48
+ )
49
+ ? `url('https://github.com/catppuccin/spicetify/blob/main/catppuccin/assets/${ colorScheme } /equalizer-animated-${ accent } .gif?raw=true')`
50
+ : `url('${ colorScheme } /equalizer-animated-${ accent } .gif')` ,
29
51
} ;
30
52
31
53
Object . entries ( properties ) . forEach ( ( [ property , value ] ) => {
35
57
document . documentElement . style . setProperty ( property , value ) ;
36
58
}
37
59
} ) ;
38
-
60
+
39
61
if ( initialValue !== selectedValue ) {
40
62
localStorage . setItem ( "catppuccin-accentColor" , selectedValue ) ;
41
63
}
50
72
{
51
73
"data-encore-id" : "type" ,
52
74
className :
53
- "Type__TypeElement-sc-goli3j-0 TypeElement-cello-textBase-type " ,
75
+ "TextElement-bodyMediumBold-textBase-text encore-text-body-medium-bold " ,
54
76
} ,
55
- "Catppuccin"
77
+ "Catppuccin" ,
56
78
) ,
57
79
Spicetify . React . createElement ( "div" , { className : "x-settings-row" } , [
58
80
Spicetify . React . createElement (
64
86
{
65
87
htmlFor : "desktop.settings.selectLanguage" ,
66
88
className :
67
- "Type__TypeElement-sc-goli3j-0 TypeElement-viola-textSubdued-type " ,
89
+ "TextElement-bodySmall-textSubdued-text encore-text-body-small " ,
68
90
"data-encore-id" : "type" ,
69
91
} ,
70
- "Choose an accent color"
92
+ "Choose an accent color" ,
71
93
) ,
72
- ]
94
+ ] ,
73
95
) ,
74
96
Spicetify . React . createElement (
75
97
"div" ,
95
117
value : option ,
96
118
selected : option === selectedValue ,
97
119
} ,
98
- option
120
+ option ,
99
121
) ;
100
- } )
122
+ } ) ,
101
123
) ,
102
124
] ) ,
103
- ]
104
- ) ,
125
+ ] ,
126
+ ) ,
105
127
] ) ,
106
- ]
128
+ ] ,
107
129
) ;
108
130
} ) ;
109
131
120
142
const sectionContainer = document . createElement ( "div" ) ;
121
143
Spicetify . ReactDOM . render (
122
144
Spicetify . React . createElement ( Section ) ,
123
- sectionContainer
145
+ sectionContainer ,
124
146
) ;
125
147
header . parentNode . insertBefore ( sectionContainer , header . nextSibling ) ;
126
148
}
127
149
} , 1 ) ;
128
150
}
129
151
130
152
// Hotload useEffect
131
- Spicetify . ReactDOM . render ( Spicetify . React . createElement ( Section ) , document . createElement ( "div" ) ) ;
153
+ Spicetify . ReactDOM . render (
154
+ Spicetify . React . createElement ( Section ) ,
155
+ document . createElement ( "div" ) ,
156
+ ) ;
132
157
133
158
// Initialize + Listener
134
159
insertOption ( Spicetify . Platform . History . location . pathname ) ;
135
- Spicetify . Platform . History . listen ( ( event ) => { insertOption ( event . pathname ) } ) ;
136
-
137
- } ) ( ) ;
160
+ Spicetify . Platform . History . listen ( ( event ) => {
161
+ insertOption ( event . pathname ) ;
162
+ } ) ;
163
+ } ) ( ) ;
0 commit comments