fix(album-color-theme): dynamic lightness

This commit is contained in:
JellyBrick
2023-09-30 15:16:04 +09:00
parent 8d475eda0a
commit 92ecf6a0b0

View File

@ -77,7 +77,7 @@ export default () => {
if (mutation.type === 'attributes') {
const isPageOpen = ytmusicAppLayout?.hasAttribute('player-page-open');
if (isPageOpen) {
changeElementColor(sidebarSmall, hue, saturation, 30);
changeElementColor(sidebarSmall, hue, saturation, lightness - 25);
} else {
if (sidebarSmall) {
sidebarSmall.style.backgroundColor = 'black';
@ -94,16 +94,16 @@ export default () => {
ipcRenderer.on('album-color-changed', (_, albumColor: FastAverageColorResult) => {
if (albumColor) {
[hue, saturation, lightness] = hexToHSL(albumColor.hex);
changeElementColor(playerPage, hue, saturation, 30);
changeElementColor(navBarBackground, hue, saturation, 15);
changeElementColor(ytmusicPlayerBar, hue, saturation, 15);
changeElementColor(playerBarBackground, hue, saturation, 15);
changeElementColor(sidebarBig, hue, saturation, 15);
changeElementColor(playerPage, hue, saturation, lightness - 25);
changeElementColor(navBarBackground, hue, saturation, lightness - 15);
changeElementColor(ytmusicPlayerBar, hue, saturation, lightness - 15);
changeElementColor(playerBarBackground, hue, saturation, lightness - 15);
changeElementColor(sidebarBig, hue, saturation, lightness - 15);
if (ytmusicAppLayout?.hasAttribute('player-page-open')) {
changeElementColor(sidebarSmall, hue, saturation, 30);
changeElementColor(sidebarSmall, hue, saturation, lightness - 25);
}
const ytRightClickList = document.querySelector<HTMLElement>('tp-yt-paper-listbox');
changeElementColor(ytRightClickList, hue, saturation, 15);
changeElementColor(ytRightClickList, hue, saturation, lightness - 15);
} else {
if (playerPage) {
playerPage.style.backgroundColor = '#000000';