Fixes and Improvements

- Fix some features not working in newer Spotify versions (Reflection, Connected devices triangle)
- (Hopefully) Fix color scheme detection when installed from marketplace
- Fix some elements becoming opaque after color change in Marketplace
This commit is contained in:
Motschen
2023-05-05 21:58:13 +02:00
parent 2217062392
commit 327c48e4e1
2 changed files with 42 additions and 15 deletions

View File

@@ -1,14 +1,26 @@
/* Based on https://github.com/harbassan/spicetify-galaxy/blob/main/galaxy.js /* Based on https://github.com/harbassan/spicetify-galaxy/blob/main/galaxy.js
Credits to harbassan Credits to harbassan
*/ */
(function retroblur() { (async function retroblur() {
const YouTubeSVG = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><g fill="gray"><rect width="14.3" height="3.7" x=".8" y="11.5" ry=".1"/><rect width="5" height="5.6" x="-9.6" y="8.2" rx="0" ry=".1" transform="matrix(.63163 -.77527 .80715 .59035 0 0)"/><rect width="4.5" height="4.6" x="-1.3" y="13.1" rx="0" ry=".1" transform="matrix(.9021 -.43155 .62218 .78288 0 0)"/></g><g fill="#fff"><rect width="16" height="1.6" ry=".8"/><rect width="16" height="1.6" y="14.4" ry=".8"/><rect width="1.5" height="15.9" y=".1" ry=".8"/><rect width="1.7" height="15.9" x="14.3" ry=".8"/><ellipse cx="11.2" cy="4.4" rx="1.8" ry="1.9"/><rect width="2.7" height=".5" x="6.3" y="4.2" ry=".2"/><rect width="2.7" height=".5" x="4.9" y="7.1" ry=".2" transform="rotate(-14)"/><rect width="2.1" height=".5" x="6.6" y="-11.3" ry=".2" transform="rotate(90)"/><rect width="2.7" height=".5" x="7.1" y=".1" ry=".2" transform="rotate(18)"/><rect width="2.7" height=".5" x="-4.6" y="11.6" ry=".2" transform="rotate(-67)"/><rect width="2.7" height=".5" x="10" y="-9.6" ry=".2" transform="rotate(70)"/><rect width="2.7" height=".5" x=".1" y="10.5" ry=".2" transform="rotate(-43)"/></g></svg>` const YouTubeSVG = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><g fill="gray"><rect width="14.3" height="3.7" x=".8" y="11.5" ry=".1"/><rect width="5" height="5.6" x="-9.6" y="8.2" rx="0" ry=".1" transform="matrix(.63163 -.77527 .80715 .59035 0 0)"/><rect width="4.5" height="4.6" x="-1.3" y="13.1" rx="0" ry=".1" transform="matrix(.9021 -.43155 .62218 .78288 0 0)"/></g><g fill="#fff"><rect width="16" height="1.6" ry=".8"/><rect width="16" height="1.6" y="14.4" ry=".8"/><rect width="1.5" height="15.9" y=".1" ry=".8"/><rect width="1.7" height="15.9" x="14.3" ry=".8"/><ellipse cx="11.2" cy="4.4" rx="1.8" ry="1.9"/><rect width="2.7" height=".5" x="6.3" y="4.2" ry=".2"/><rect width="2.7" height=".5" x="4.9" y="7.1" ry=".2" transform="rotate(-14)"/><rect width="2.1" height=".5" x="6.6" y="-11.3" ry=".2" transform="rotate(90)"/><rect width="2.7" height=".5" x="7.1" y=".1" ry=".2" transform="rotate(18)"/><rect width="2.7" height=".5" x="-4.6" y="11.6" ry=".2" transform="rotate(-67)"/><rect width="2.7" height=".5" x="10" y="-9.6" ry=".2" transform="rotate(70)"/><rect width="2.7" height=".5" x=".1" y="10.5" ry=".2" transform="rotate(-43)"/></g></svg>`
if (!(Spicetify.Player.data && Spicetify.Platform)) { if (!(Spicetify.Player.data && Spicetify.Platform)) {
setTimeout(retroblur, 100); setTimeout(retroblur, 100);
return; return;
} }
if (typeof Marketplace !== 'undefined') console.log("(Retroblur) Selected marketplace theme: "+Marketplace.export()["marketplace:installed-themes"])
async function waitForMarketplaceColors() {
return new Promise((resolve) => {
setInterval(() => {
if (typeof Marketplace == 'undefined' || Marketplace.export()["marketplace:installed-themes"] == "[]") resolve(null);
const marketplaceScheme = document.querySelector("style.marketplaceCSS.marketplaceScheme");
if (marketplaceScheme) {
resolve(marketplaceScheme);
}
}, 50);
});
}
console.log("retroblur wallpaper changer running"); console.log("(Retroblur) Wallpaper Changer running");
Object.keys(localStorage).forEach(item => { Object.keys(localStorage).forEach(item => {
if (item.includes("retroblur:temp")) localStorage.removeItem(item); if (item.includes("retroblur:temp")) localStorage.removeItem(item);
@@ -28,30 +40,32 @@
} }
var defImage = `https://github.com/Motschen/Retroblur/blob/main/assets/background_purple.jpg?raw=true`; var defImage = `https://github.com/Motschen/Retroblur/blob/main/assets/background_purple.jpg?raw=true`;
console.log(getComputedStyle(document.body).getPropertyValue("--spice-button")) console.log("(Retroblur) Button color is '"+getComputedStyle(document.body).getPropertyValue("--spice-button")+"'")
switch (getComputedStyle(document.body).getPropertyValue("--spice-button")) { const marketplaceSchemeCSS = await waitForMarketplaceColors();
const buttonColor = marketplaceSchemeCSS == null ? getComputedStyle(document.body).getPropertyValue("--spice-button") : getComputedStyle(marketplaceSchemeCSS).getPropertyValue("--spice-button");
switch (buttonColor) {
case " #00bbff": { case " #00bbff": {
console.log("setting default wallpaper to water"); console.log("(Retroblur) Setting default wallpaper to Water");
defImage = "https://images.unsplash.com/photo-1502933691298-84fc14542831?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1170&q=80"; defImage = "https://images.unsplash.com/photo-1502933691298-84fc14542831?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1170&q=80";
break; break;
} }
case " #b0fd68": { case " #b0fd68": {
console.log("setting default wallpaper to lush"); console.log("(Retroblur) Setting default wallpaper to Lush");
defImage = "https://images3.alphacoders.com/356/35627.jpg"; defImage = "https://images3.alphacoders.com/356/35627.jpg";
break; break;
} }
case " #ceeb26": { case " #ceeb26": {
console.log("setting default wallpaper to sun"); console.log("(Retroblur) Setting default wallpaper to Sun");
defImage = "https://images.unsplash.com/photo-1516370873344-fb7c61054fa9?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1170&q=80"; defImage = "https://images.unsplash.com/photo-1516370873344-fb7c61054fa9?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1170&q=80";
break; break;
} }
case " #ebb726": { case " #ebb726": {
console.log("setting default wallpaper to sunset"); console.log("(Retroblur) Setting default wallpaper to Sunset");
defImage = "https://4kwallpapers.com/images/walls/thumbs_3t/4928.jpg"; defImage = "https://4kwallpapers.com/images/walls/thumbs_3t/4928.jpg";
break; break;
} }
case " #a10003": { case " #a10003": {
console.log("setting default wallpaper to mercy"); console.log("(Retroblur) Setting default wallpaper to Mercy");
defImage = "https://images3.alphacoders.com/356/35627.jpg"; defImage = "https://images3.alphacoders.com/356/35627.jpg";
break; break;
} }
@@ -63,7 +77,7 @@
var image = imageData; var image = imageData;
if (config.matchWallpaperToTheme) image = defImage; if (config.matchWallpaperToTheme) image = defImage;
document.body.style.backgroundImage = "url("+image+")"; document.body.style.backgroundImage = "url("+image+")";
console.log("setBG"+image) console.log("(Retroblur) Setting Wallpaper: "+image)
} }
// input for custom background images // input for custom background images

View File

@@ -6,7 +6,8 @@
--scrollbars: unset; --scrollbars: unset;
--spice-main: transparent; --spice-main: transparent;
--spice-misc: rgba(30, 30, 30, 0.8); --spice-misc: rgba(30, 30, 30, 0.8);
--spice-player: rgba(30, 30, 30, 0.5); --spice-player: rgba(30, 30, 30, 0.45);
--retroblur-player: rgba(30, 30, 30, 0.45); /* --spice-player is changed by marketplace on color change */
} }
/* /*
Set the wallpaper to one matching your color scheme Set the wallpaper to one matching your color scheme
@@ -37,7 +38,7 @@
body { body {
/* Set the wallpaper link below */ /* Set the wallpaper link below */
/* vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv */ /* vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv */
background-image: linear-gradient(left, #000000, #000000); background: #000000;
/* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ */ /* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ */
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: 100%; background-size: 100%;
@@ -161,9 +162,10 @@ div[aria-selected="true"] > div > div.main-trackList-rowSectionStart > div > div
color: black; color: black;
opacity: 90%; opacity: 90%;
} }
.iUSAh1wdhXLk9hHSbkCA.hsrxlVHxK0zZrgarkxuA:after { #main > div > div.Root__top-container.Root__top-container--right-sidebar-hidden > div.Root__now-playing-bar > footer > div.main-nowPlayingBar-nowPlayingBar > div.main-nowPlayingBar-right > div > div.main-contextMenu-tippyWrapper > div > div {
transform: scaleY(-1); transform: scaleY(-1);
bottom: 67px; bottom: 67px;
opacity: 90%;
} }
.yaVzc4bseRnztmfRv_u3, .volume-bar .progress-bar__slider { .yaVzc4bseRnztmfRv_u3, .volume-bar .progress-bar__slider {
filter: drop-shadow(0 0 6px var(--spice-button)) !important; filter: drop-shadow(0 0 6px var(--spice-button)) !important;
@@ -235,6 +237,7 @@ div.GlueDropTarget.personal-library {
/* Shows a reflection of the big cover image */ /* Shows a reflection of the big cover image */
.main-coverSlotExpanded-container { .main-coverSlotExpanded-container {
-webkit-box-reflect: below; -webkit-box-reflect: below;
position: initial;
} }
.main-home-content, .main-entityHeader-backgroundColor, .main-actionBar-ActionBar, .content-spacing, :root, .main-navBar-navBar, .D_XKXBZDhgpM1KrmKy3O, .spotify__container--is-desktop:not(.fullscreen) .main-navBar-entryPoints { .main-home-content, .main-entityHeader-backgroundColor, .main-actionBar-ActionBar, .content-spacing, :root, .main-navBar-navBar, .D_XKXBZDhgpM1KrmKy3O, .spotify__container--is-desktop:not(.fullscreen) .main-navBar-entryPoints {
background-color: transparent !important; background-color: transparent !important;
@@ -940,7 +943,7 @@ CANVAS!!!
/* Fix your podcasts items having no background */ /* Fix your podcasts items having no background */
.TT1tIewS2iI8Uz8kLuQB { .TT1tIewS2iI8Uz8kLuQB {
backdrop-filter: blur(10px); backdrop-filter: blur(10px);
background: var(--spice-player); background: var(--retroblur-player);
border-radius: 10px; border-radius: 10px;
} }
.TT1tIewS2iI8Uz8kLuQB:hover { .TT1tIewS2iI8Uz8kLuQB:hover {
@@ -950,7 +953,7 @@ CANVAS!!!
#marketplace-readme, .x-settings-container { #marketplace-readme, .x-settings-container {
border-radius: 10px; border-radius: 10px;
backdrop-filter: blur(10px); backdrop-filter: blur(10px);
background: var(--spice-player) !important; background: var(--retroblur-player) !important;
} }
#marketplace-readme a { #marketplace-readme a {
color: var(--spice-text) !important; color: var(--spice-text) !important;
@@ -1095,4 +1098,14 @@ span.toggle.enabled {
} }
#wallpaper-select > div.main-playlistEditDetailsModal-imageChangeButton > div > button { #wallpaper-select > div.main-playlistEditDetailsModal-imageChangeButton > div > button {
border-radius: 10px; border-radius: 10px;
}
.playlist-playlist-playlistContent {
background: transparent;
}
/* Fixes bottom bar not being transparent after color change in marketplace */
.main-nowPlayingBar-container {
background-color: var(--retroblur-player);
}
a[class*='-tabBar-active'] {
backdrop-filter: blur(2px);
} }