1
1
mirror of https://github.com/kokonect-link/cherrypick synced 2024-11-28 14:58:29 +09:00

fix header alpha (friendly)

This commit is contained in:
NoriDev 2023-05-27 18:14:57 +09:00
parent b9599bedf9
commit 208855ccea

View File

@ -106,7 +106,7 @@ function onTabClick(): void {
const calcBg = () => {
const rawBg = 'var(--bg)';
const tinyBg = tinycolor(rawBg.startsWith('var(') ? getComputedStyle(document.documentElement).getPropertyValue(rawBg.slice(4, -1)) : rawBg);
if (isFriendly.value && narrow.value) tinyBg.setAlpha(1);
if (isFriendly.value && narrow) tinyBg.setAlpha(1);
else tinyBg.setAlpha(0.85);
bg.value = tinyBg.toRgbString();
};
@ -114,9 +114,6 @@ const calcBg = () => {
let ro: ResizeObserver | null;
onMounted(() => {
calcBg();
globalEvents.on('themeChanged', calcBg);
if (el && el.parentElement) {
narrow = el.parentElement.offsetWidth < 500;
ro = new ResizeObserver((entries, observer) => {
@ -126,6 +123,9 @@ onMounted(() => {
});
ro.observe(el.parentElement as HTMLElement);
}
calcBg();
globalEvents.on('themeChanged', calcBg);
});
onUnmounted(() => {