Skip to content

Commit 1f93de5

Browse files
authored
refactor: remove white accent in favour of none (#62)
1 parent 06565db commit 1f93de5

9 files changed

+23
-14
lines changed
Loading
Binary file not shown.
Loading
Loading
Binary file not shown.
Loading
Binary file not shown.

catppuccin/color.ini

+3-5
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ blue = 8caaee
4444
sky = 99dadb
4545
mauve = ca9ee6
4646
lavender = babbf1
47-
white = d9e0ee
48-
mauve = ca9ee6
47+
4948

5049
[latte]
5150
# Spicetify
@@ -93,7 +92,7 @@ blue = 1e66f5
9392
sky = 04a5e5
9493
mauve = 8839ef
9594
lavender = 7287fd
96-
white = d9e0ee
95+
9796

9897

9998
[macchiato]
@@ -142,7 +141,7 @@ blue = 8aadf4
142141
sky = 91d7e3
143142
mauve = c6a0f6
144143
lavender = b7bdf8
145-
white = d9e0ee
144+
146145

147146
[mocha]
148147
# Spicetify
@@ -190,4 +189,3 @@ blue = 89b4fa
190189
sky = 89dceb
191190
mauve = cba6f7
192191
lavender = b4befe
193-
white = d9e0ee

catppuccin/theme.js

+20-9
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,34 @@
1111
return;
1212
}
1313

14-
// accent colors
15-
const accents = ['rosewater','flamingo','pink','maroon','red','peach','yellow','green','teal','sapphire','blue','sky','mauve','lavender','white'];
14+
// Accent colors
15+
const accents = ['none', 'rosewater', 'flamingo', 'pink', 'maroon', 'red', 'peach', 'yellow', 'green', 'teal', 'sapphire', 'blue', 'sky', 'mauve', 'lavender'];
1616

1717
// Create our own section matching spotifys style and structure
1818
const Section = Spicetify.React.memo(() => {
19-
const initialValue = localStorage.getItem('catppuccin-accentColor') ?? 'rosewater';
19+
const colorScheme = Spicetify.Config.color_scheme || "frappe";
20+
const initialValue = localStorage.getItem('catppuccin-accentColor') ?? 'none';
2021
const [selectedValue, setSelectedValue] = Spicetify.React.useState(initialValue);
2122

2223
Spicetify.React.useEffect(() => {
24+
const accent = selectedValue === "none" ? "text" : selectedValue;
25+
const properties = {
26+
"--spice-text": `var(--spice-${selectedValue})`,
27+
"--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')`
29+
};
30+
31+
Object.entries(properties).forEach(([property, value]) => {
32+
if (value.includes("none")) {
33+
document.documentElement.style.removeProperty(property);
34+
} else {
35+
document.documentElement.style.setProperty(property, value);
36+
}
37+
});
38+
2339
if (initialValue !== selectedValue) {
2440
localStorage.setItem("catppuccin-accentColor", selectedValue);
2541
}
26-
27-
const url = document.querySelector("body > script.marketplaceScript") ? `url('https://github.com/catppuccin/spicetify/blob/main/catppuccin/assets/${Spicetify.Config.color_scheme}/equalizer-animated-${selectedValue}.gif?raw=true')` : `url('${Spicetify.Config.color_scheme}/equalizer-animated-${selectedValue}.gif')`
28-
document.documentElement.style.setProperty("--spice-text", `var(--spice-${selectedValue})`);
29-
document.documentElement.style.setProperty("--spice-button-active", `var(--spice-${selectedValue})`),
30-
document.documentElement.style.setProperty("--spice-equalizer", url);
3142
}, [selectedValue]);
3243

3344
return Spicetify.React.createElement(
@@ -82,7 +93,7 @@
8293
{
8394
key: option,
8495
value: option,
85-
selected: selectedValue,
96+
selected: option === selectedValue,
8697
},
8798
option
8899
);

0 commit comments

Comments
 (0)