2023-07-27 05:31:52 +00:00
|
|
|
/*
|
2024-02-13 15:59:27 +00:00
|
|
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
2023-07-27 05:31:52 +00:00
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
2021-11-28 11:07:37 +00:00
|
|
|
import { Directive } from 'vue';
|
2024-10-19 09:02:09 +00:00
|
|
|
import { getBgColor } from '@/scripts/get-bg-color.js';
|
2021-11-28 11:07:37 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
mounted(src, binding, vn) {
|
2024-10-19 09:02:09 +00:00
|
|
|
const parentBg = getBgColor(src.parentElement) ?? 'transparent';
|
2021-11-28 11:07:37 +00:00
|
|
|
|
2024-10-09 09:08:14 +00:00
|
|
|
const myBg = getComputedStyle(document.documentElement).getPropertyValue('--MI_THEME-panel');
|
2021-11-28 11:07:37 +00:00
|
|
|
|
|
|
|
if (parentBg === myBg) {
|
2024-10-09 09:08:14 +00:00
|
|
|
src.style.backgroundColor = 'var(--MI_THEME-bg)';
|
2021-11-28 11:07:37 +00:00
|
|
|
} else {
|
2024-10-09 09:08:14 +00:00
|
|
|
src.style.backgroundColor = 'var(--MI_THEME-panel)';
|
2021-11-28 11:07:37 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
} as Directive;
|