1
0
Fork 0
mirror of https://github.com/paricafe/misskey.git synced 2025-03-03 15:22:10 -06:00
paricafe/packages/frontend/src/directives/adaptive-border.ts
かっこかり 2250e521e4
refactor(frontend): getBgColorを共通化 ()
* refactor: getBgColor関数の切り出し + fix types (taiyme#291)

* move thing

* revert unnecesary changes

---------

Co-authored-by: taiy <53635909+taiyme@users.noreply.github.com>
2024-10-19 18:02:09 +09:00

21 lines
519 B
TypeScript

/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { Directive } from 'vue';
import { getBgColor } from '@/scripts/get-bg-color.js';
export default {
mounted(src, binding, vn) {
const parentBg = getBgColor(src.parentElement) ?? 'transparent';
const myBg = window.getComputedStyle(src).backgroundColor;
if (parentBg === myBg) {
src.style.borderColor = 'var(--MI_THEME-divider)';
} else {
src.style.borderColor = myBg;
}
},
} as Directive;