testing out a different artwork bg, wip
This commit is contained in:
parent
6ca8fba9e6
commit
de74127d33
7 changed files with 12535 additions and 0 deletions
|
@ -98,9 +98,23 @@ Array.prototype.limit = function (n) {
|
|||
return this.slice(0, n);
|
||||
};
|
||||
|
||||
const store = new Vuex.Store({
|
||||
state: {
|
||||
library: {
|
||||
songs: [],
|
||||
albums: [],
|
||||
recentlyAdded: [],
|
||||
playlists: []
|
||||
}
|
||||
},
|
||||
mutations: {
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
const app = new Vue({
|
||||
el: "#app",
|
||||
store: store,
|
||||
data: {
|
||||
appMode: "player",
|
||||
ipcRenderer: ipcRenderer,
|
||||
|
@ -2393,7 +2407,11 @@ const app = new Vue({
|
|||
}
|
||||
return newurl
|
||||
},
|
||||
_rgbToRgb(rgb = [0,0,0]) {
|
||||
return `rgb(${rgb[0]},${rgb[1]},${rgb[2]})`
|
||||
},
|
||||
getNowPlayingArtworkBG(size = 600) {
|
||||
let self = this
|
||||
if (typeof this.mk.nowPlayingItem === "undefined") return;
|
||||
let bginterval = setInterval(() => {
|
||||
if (!this.mkReady()) {
|
||||
|
@ -2409,6 +2427,15 @@ const app = new Vue({
|
|||
document.querySelector('.bg-artwork').src = "";
|
||||
if (this.mk["nowPlayingItem"]["attributes"]["artwork"]["url"]) {
|
||||
document.querySelector('.bg-artwork').src = this.mk["nowPlayingItem"]["attributes"]["artwork"]["url"].replace('{w}', size).replace('{h}', size);
|
||||
Vibrant.from(this.mk["nowPlayingItem"]["attributes"]["artwork"]["url"].replace('{w}', size).replace('{h}', size)).getPalette().then(palette=>{
|
||||
console.log(palette)
|
||||
if(palette.DarkMuted != null && palette.DarkVibrant != null){
|
||||
document.querySelector("#app").style.backgroundImage = `linear-gradient(to bottom, ${self._rgbToRgb(palette.DarkMuted._rgb)} 0%, ${self._rgbToRgb(palette.DarkVibrant._rgb)} 100%)`
|
||||
}else{
|
||||
document.querySelector("#app").style.backgroundImage = `linear-gradient(to bottom, ${self._rgbToRgb(palette.Muted._rgb)} 0%, ${self._rgbToRgb(palette.LightMuted._rgb)} 100%)`
|
||||
}
|
||||
})
|
||||
|
||||
try {
|
||||
clearInterval(bginterval);
|
||||
} catch (err) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue