c2370a1be6
* chore: Add the SPDX information to each file Add copyright and licensing information as defined in version 3.0 of the REUSE Specification. * tweak format --------- Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
29 lines
792 B
TypeScript
29 lines
792 B
TypeScript
/*
|
|
* SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
|
|
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 = window.getComputedStyle(src).backgroundColor;
|
|
|
|
if (parentBg === myBg) {
|
|
src.style.borderColor = 'var(--divider)';
|
|
} else {
|
|
src.style.borderColor = myBg;
|
|
}
|
|
},
|
|
} as Directive;
|