Files
misskey/packages/frontend/src/directives/panel.ts
T
かっこかり b528ff9c59 enhance(frontend): テーマの適用管理を改善 (#17376)
* wip

* add test

* use themeManager.currentCompiledTheme for obtaining theme variables / reduce getComputedStyle usage

* fix

* fix: better error handling on theme installation

* Update Changelog

* chore: remove frontend-shared builds as it is currently working as a stub package

* fix: broken lockfile

* fix

* fix lint

* fix
2026-05-07 11:42:45 +09:00

23 lines
600 B
TypeScript

/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import type { Directive } from 'vue';
import { themeManager } from '@/theme.js';
import { getBgColor } from '@/utility/get-bg-color.js';
export const panelDirective = {
mounted(src) {
const parentBg = getBgColor(src.parentElement) ?? 'transparent';
const myBg = themeManager.currentCompiledTheme!.panel;
if (parentBg === myBg) {
src.style.backgroundColor = 'var(--MI_THEME-bg)';
} else {
src.style.backgroundColor = 'var(--MI_THEME-panel)';
}
},
} as Directive<HTMLElement>;