mirror of
https://activitypub.software/TransFem-org/Sharkey.git
synced 2024-12-16 10:11:54 +01:00
5e29528ad4
* chore: fix some lints automatically Fixed lints that were automatically fixable with `eslint --fix`. * fix type * workaround for empty interface lint
24 lines
717 B
TypeScript
24 lines
717 B
TypeScript
import { Directive } from 'vue';
|
|
|
|
export default {
|
|
mounted(src, binding, vn) {
|
|
const getBgColor = (el: HTMLElement) => {
|
|
const style = window.getComputedStyle(el);
|
|
if (style.backgroundColor && !['rgba(0, 0, 0, 0)', 'rgba(0,0,0,0)', 'transparent'].includes(style.backgroundColor)) {
|
|
return style.backgroundColor;
|
|
} else {
|
|
return el.parentElement ? getBgColor(el.parentElement) : 'transparent';
|
|
}
|
|
};
|
|
|
|
const parentBg = getBgColor(src.parentElement);
|
|
|
|
const myBg = getComputedStyle(document.documentElement).getPropertyValue('--panel');
|
|
|
|
if (parentBg === myBg) {
|
|
src.style.backgroundColor = 'var(--bg)';
|
|
} else {
|
|
src.style.backgroundColor = 'var(--panel)';
|
|
}
|
|
},
|
|
} as Directive;
|