mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-13 11:21:46 +00:00
feat: Album Color Theme plugin
Co-authored-by: EdiBOI25 <86252338+EdiBOI25@users.noreply.github.com>
This commit is contained in:
@ -5,6 +5,8 @@ import { Color, Titlebar } from 'custom-electron-titlebar';
|
||||
import config from '../../config';
|
||||
import { isEnabled } from '../../config/plugins';
|
||||
|
||||
import type { FastAverageColorResult } from 'fast-average-color';
|
||||
|
||||
function $(selector: string) {
|
||||
return document.querySelector(selector);
|
||||
}
|
||||
@ -38,6 +40,16 @@ export default () => {
|
||||
}
|
||||
});
|
||||
|
||||
if (isEnabled('album-color-theme')) {
|
||||
ipcRenderer.on('album-color-changed', (_, albumColor: FastAverageColorResult) => {
|
||||
if (albumColor) {
|
||||
bar.updateBackground(Color.fromHex(albumColor.hexa));
|
||||
} else {
|
||||
bar.updateBackground(Color.fromHex('#050505'));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (isEnabled('picture-in-picture')) {
|
||||
ipcRenderer.on('pip-toggle', () => {
|
||||
bar.refreshMenu();
|
||||
|
||||
Reference in New Issue
Block a user