mirror of
https://iceshrimp.dev/crimekillz/trashposs
synced 2024-11-24 01:39:06 +01:00
c8374e8ace
* chore: fix some lints automatically Fixed lints that were automatically fixable with `eslint --fix`. * fix type * workaround for empty interface lint
25 lines
678 B
TypeScript
25 lines
678 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 = window.getComputedStyle(src).backgroundColor;
|
|
|
|
if (parentBg === myBg) {
|
|
src.style.borderColor = 'var(--divider)';
|
|
} else {
|
|
src.style.borderColor = myBg;
|
|
}
|
|
},
|
|
} as Directive;
|