Skip to content

Commit 2f2718d

Browse files
committed
fix(extension): update settings-section classnames & format
1 parent ba39869 commit 2f2718d

File tree

1 file changed

+46
-20
lines changed

1 file changed

+46
-20
lines changed

catppuccin/theme.js

+46-20
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,42 @@
1212
}
1313

1414
// 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+
];
1632

1733
// Create our own section matching spotifys style and structure
1834
const Section = Spicetify.React.memo(() => {
1935
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);
2240

2341
Spicetify.React.useEffect(() => {
2442
const accent = selectedValue === "none" ? "text" : selectedValue;
2543
const properties = {
2644
"--spice-text": `var(--spice-${selectedValue})`,
2745
"--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')`,
2951
};
3052

3153
Object.entries(properties).forEach(([property, value]) => {
@@ -35,7 +57,7 @@
3557
document.documentElement.style.setProperty(property, value);
3658
}
3759
});
38-
60+
3961
if (initialValue !== selectedValue) {
4062
localStorage.setItem("catppuccin-accentColor", selectedValue);
4163
}
@@ -50,9 +72,9 @@
5072
{
5173
"data-encore-id": "type",
5274
className:
53-
"Type__TypeElement-sc-goli3j-0 TypeElement-cello-textBase-type",
75+
"TextElement-bodyMediumBold-textBase-text encore-text-body-medium-bold",
5476
},
55-
"Catppuccin"
77+
"Catppuccin",
5678
),
5779
Spicetify.React.createElement("div", { className: "x-settings-row" }, [
5880
Spicetify.React.createElement(
@@ -64,12 +86,12 @@
6486
{
6587
htmlFor: "desktop.settings.selectLanguage",
6688
className:
67-
"Type__TypeElement-sc-goli3j-0 TypeElement-viola-textSubdued-type",
89+
"TextElement-bodySmall-textSubdued-text encore-text-body-small",
6890
"data-encore-id": "type",
6991
},
70-
"Choose an accent color"
92+
"Choose an accent color",
7193
),
72-
]
94+
],
7395
),
7496
Spicetify.React.createElement(
7597
"div",
@@ -95,15 +117,15 @@
95117
value: option,
96118
selected: option === selectedValue,
97119
},
98-
option
120+
option,
99121
);
100-
})
122+
}),
101123
),
102124
]),
103-
]
104-
),
125+
],
126+
),
105127
]),
106-
]
128+
],
107129
);
108130
});
109131

@@ -120,18 +142,22 @@
120142
const sectionContainer = document.createElement("div");
121143
Spicetify.ReactDOM.render(
122144
Spicetify.React.createElement(Section),
123-
sectionContainer
145+
sectionContainer,
124146
);
125147
header.parentNode.insertBefore(sectionContainer, header.nextSibling);
126148
}
127149
}, 1);
128150
}
129151

130152
// 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+
);
132157

133158
// Initialize + Listener
134159
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

Comments
 (0)