SpotifyControls: export album cover as CSS variable for themes (#2197)
--vc-spotify-track-image
This commit is contained in:
parent
9958f5a2ea
commit
5e7b4e9c92
3 changed files with 10 additions and 2 deletions
|
@ -371,6 +371,10 @@ export function Player() {
|
||||||
if (!track || !device?.is_active || shouldHide)
|
if (!track || !device?.is_active || shouldHide)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
const exportTrackImageStyle = {
|
||||||
|
"--vc-spotify-track-image": `url(${track?.album?.image?.url || ""})`,
|
||||||
|
} as React.CSSProperties;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ErrorBoundary fallback={() => (
|
<ErrorBoundary fallback={() => (
|
||||||
<div className="vc-spotify-fallback">
|
<div className="vc-spotify-fallback">
|
||||||
|
@ -378,7 +382,7 @@ export function Player() {
|
||||||
<p >Check the console for errors</p>
|
<p >Check the console for errors</p>
|
||||||
</div>
|
</div>
|
||||||
)}>
|
)}>
|
||||||
<div id={cl("player")}>
|
<div id={cl("player")} style={exportTrackImageStyle}>
|
||||||
<Info track={track} />
|
<Info track={track} />
|
||||||
<SeekBar />
|
<SeekBar />
|
||||||
<Controls />
|
<Controls />
|
||||||
|
|
|
@ -31,7 +31,7 @@ function toggleHoverControls(value: boolean) {
|
||||||
export default definePlugin({
|
export default definePlugin({
|
||||||
name: "SpotifyControls",
|
name: "SpotifyControls",
|
||||||
description: "Adds a Spotify player above the account panel",
|
description: "Adds a Spotify player above the account panel",
|
||||||
authors: [Devs.Ven, Devs.afn, Devs.KraXen72],
|
authors: [Devs.Ven, Devs.afn, Devs.KraXen72, Devs.Av32000],
|
||||||
options: {
|
options: {
|
||||||
hoverControls: {
|
hoverControls: {
|
||||||
description: "Show controls on hover",
|
description: "Show controls on hover",
|
||||||
|
|
|
@ -414,6 +414,10 @@ export const Devs = /* #__PURE__*/ Object.freeze({
|
||||||
coolelectronics: {
|
coolelectronics: {
|
||||||
name: "coolelectronics",
|
name: "coolelectronics",
|
||||||
id: 696392247205298207n,
|
id: 696392247205298207n,
|
||||||
|
},
|
||||||
|
Av32000: {
|
||||||
|
name: "Av32000",
|
||||||
|
id: 593436735380127770n,
|
||||||
}
|
}
|
||||||
} satisfies Record<string, Dev>);
|
} satisfies Record<string, Dev>);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue