Skip to content

Commit

Permalink
refactor: remove white accent in favour of none (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
ohitstom authored Jan 17, 2024
1 parent 06565db commit 1f93de5
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 14 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed catppuccin/assets/mocha/equalizer-animated-white.gif
Binary file not shown.
8 changes: 3 additions & 5 deletions catppuccin/color.ini
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ blue = 8caaee
sky = 99dadb
mauve = ca9ee6
lavender = babbf1
white = d9e0ee
mauve = ca9ee6


[latte]
# Spicetify
Expand Down Expand Up @@ -93,7 +92,7 @@ blue = 1e66f5
sky = 04a5e5
mauve = 8839ef
lavender = 7287fd
white = d9e0ee



[macchiato]
Expand Down Expand Up @@ -142,7 +141,7 @@ blue = 8aadf4
sky = 91d7e3
mauve = c6a0f6
lavender = b7bdf8
white = d9e0ee


[mocha]
# Spicetify
Expand Down Expand Up @@ -190,4 +189,3 @@ blue = 89b4fa
sky = 89dceb
mauve = cba6f7
lavender = b4befe
white = d9e0ee
29 changes: 20 additions & 9 deletions catppuccin/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,34 @@
return;
}

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

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

Spicetify.React.useEffect(() => {
const accent = selectedValue === "none" ? "text" : selectedValue;
const properties = {
"--spice-text": `var(--spice-${selectedValue})`,
"--spice-button-active": `var(--spice-${selectedValue})`,
"--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')`
};

Object.entries(properties).forEach(([property, value]) => {
if (value.includes("none")) {
document.documentElement.style.removeProperty(property);
} else {
document.documentElement.style.setProperty(property, value);
}
});

if (initialValue !== selectedValue) {
localStorage.setItem("catppuccin-accentColor", selectedValue);
}

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')`
document.documentElement.style.setProperty("--spice-text", `var(--spice-${selectedValue})`);
document.documentElement.style.setProperty("--spice-button-active", `var(--spice-${selectedValue})`),
document.documentElement.style.setProperty("--spice-equalizer", url);
}, [selectedValue]);

return Spicetify.React.createElement(
Expand Down Expand Up @@ -82,7 +93,7 @@
{
key: option,
value: option,
selected: selectedValue,
selected: option === selectedValue,
},
option
);
Expand Down

0 comments on commit 1f93de5

Please sign in to comment.