feat: Album Color Theme plugin

Co-authored-by: EdiBOI25 <86252338+EdiBOI25@users.noreply.github.com>
This commit is contained in:
JellyBrick
2023-09-27 18:19:23 +09:00
parent 170e2a696e
commit 6bb33453c7
6 changed files with 483 additions and 16 deletions

View File

@ -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();