MCPcopy
hub / github.com/spicetify/cli / fetchColors

Method fetchColors

CustomApps/lyrics-plus/index.js:266–288  ·  view source on GitHub ↗
(uri)

Source from the content-addressed store, hash-verified

264 }
265
266 async fetchColors(uri) {
267 let vibrant = 0;
268 try {
269 try {
270 const { fetchExtractedColorForTrackEntity } = Spicetify.GraphQL.Definitions;
271 const { data } = await Spicetify.GraphQL.Request(fetchExtractedColorForTrackEntity, { uri });
272 const { hex } = data.trackUnion.albumOfTrack.coverArt.extractedColors.colorDark;
273 vibrant = Number.parseInt(hex.replace("#", ""), 16);
274 } catch {
275 const colors = await Spicetify.CosmosAsync.get(`https://spclient.wg.spotify.com/colorextractor/v1/extract-presets?uri=${uri}&format=json`);
276 vibrant = colors.entries[0].color_swatches.find((color) => color.preset === "VIBRANT_NON_ALARMING").color;
277 }
278 } catch {
279 vibrant = 8747370;
280 }
281
282 this.setState({
283 colors: {
284 background: Utils.convertIntToRGB(vibrant),
285 inactive: Utils.convertIntToRGB(vibrant, 3),
286 },
287 });
288 }
289
290 async fetchTempo(uri) {
291 const audio = await Spicetify.CosmosAsync.get(

Callers 1

fetchLyricsMethod · 0.95

Calls 1

setStateMethod · 0.80

Tested by

no test coverage detected