remove "spotify" as color selection algorithm

This commit is contained in:
Send_Nukez 2021-12-18 23:23:34 +01:00
parent ca0d24fd11
commit e50b8b4bb3

View file

@ -550,11 +550,10 @@ Dribbblish.on("ready", () => {
Algorithm of selecting colors from the albumart Algorithm of selecting colors from the albumart
- **Colorthief [(see)](https://lokeshdhakar.com/projects/color-thief/):** Gets more fitting colors - **Colorthief [(see)](https://lokeshdhakar.com/projects/color-thief/):** Gets more fitting colors
- **Vibrant [(see)](https://jariz.github.io/vibrant.js/):** Gets more vibrant colors *(was the default up to v3.1.1)* - **Vibrant [(see)](https://jariz.github.io/vibrant.js/):** Gets more vibrant colors *(was the default up to v3.1.1)*
- **Spotify:** Basically Vibrant but internal and without support of local files
- **Static:** Select a static color to be used - **Static:** Select a static color to be used
{.muted} {.muted}
`, `,
data: { spotify: "Spotify", colorthief: "Colorthief", vibrant: "Vibrant", static: "Static" }, data: { colorthief: "Colorthief", vibrant: "Vibrant", static: "Static" },
defaultValue: "colorthief", defaultValue: "colorthief",
onChange: () => updateColors(), onChange: () => updateColors(),
showChildren: (val) => { showChildren: (val) => {
@ -791,13 +790,7 @@ Dribbblish.on("ready", () => {
const colorSelectionMode = Dribbblish.config.get("colorSelectionMode"); const colorSelectionMode = Dribbblish.config.get("colorSelectionMode");
let palette = {}; let palette = {};
if (colorSelectionAlgorithm == "spotify") { if (colorSelectionAlgorithm == "colorthief") {
const swatches = await Spicetify.colorExtractor(Spicetify.Player.data.track.uri);
for (const col of ["VIBRANT", "VIBRANT_NON_ALARMING", "PROMINENT", "DARK_VIBRANT", "LIGHT_VIBRANT", "DESATURATED"]) {
const c = chroma(swatches[col]);
palette[c.luminance()] = c;
}
} else if (colorSelectionAlgorithm == "colorthief") {
palette = Object.fromEntries([colorThief.getColor(img), ...colorThief.getPalette(img, 24, 5)].map((c) => chroma(c)).map((c) => [c.luminance(), c])); palette = Object.fromEntries([colorThief.getColor(img), ...colorThief.getPalette(img, 24, 5)].map((c) => chroma(c)).map((c) => [c.luminance(), c]));
} else if (colorSelectionAlgorithm == "vibrant") { } else if (colorSelectionAlgorithm == "vibrant") {
const swatches = await new Promise((resolve, reject) => new Vibrant(img, 5).getPalette().then(resolve).catch(reject)); const swatches = await new Promise((resolve, reject) => new Vibrant(img, 5).getPalette().then(resolve).catch(reject));