Skip to content

Commit 8b9d42b

Browse files
committed
fix(scss): fix media query light/dark themes
1 parent 09a0903 commit 8b9d42b

File tree

6 files changed

+49
-15
lines changed

6 files changed

+49
-15
lines changed

src/components/common/background/GridBackground.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,13 @@ onBeforeUnmount(() => window.removeEventListener('resize', handleResize));
6363
.grid-item {
6464
width: var(--grid-size);
6565
height: var(--grid-size);
66-
border-top: 0.1px solid var(--bg-blur-black);
67-
border-left: 0.1px solid var(--bg-blur-black);
66+
border-top: 0.1px solid var(--bg-blur-bg);
67+
border-left: 0.1px solid var(--bg-blur-bg);
6868
transition: background-color 0.25s var(--n-bezier);
6969
will-change: background-color;
7070
7171
&:hover {
72-
background-color: var(--bg-blur-black-hover);
72+
background-color: var(--bg-blur-bg-hover);
7373
transition: none;
7474
}
7575
}

src/components/common/navbar/NavbarSettingsDopdown.vue

+16-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import {
2525
useUserSettingsStore,
2626
useUserSettingsStoreRefs,
2727
} from '~/stores/settings/user.store';
28-
import { Blurs, Colors } from '~/styles/colors.style';
2928
import { useI18n } from '~/utils';
3029
3130
import { chromeRuntimeId, createTab } from '~/utils/browser/browser.utils';
@@ -146,8 +145,6 @@ const onSelect: DropdownProps['onSelect'] = async (key: string, { label }) => {
146145
'text-align': 'left',
147146
'min-width': 'max(calc(100vw / 6), 8rem)',
148147
'max-width': '20rem',
149-
'background-color': Colors.bgBlurBlackHover,
150-
'backdrop-filter': Blurs.blur,
151148
}"
152149
@select="onSelect"
153150
>
@@ -182,3 +179,19 @@ const onSelect: DropdownProps['onSelect'] = async (key: string, { label }) => {
182179
</NFlex>
183180
</NDropdown>
184181
</template>
182+
183+
<style lang="scss">
184+
@use '~/styles/mixin' as mixin;
185+
186+
.n-dropdown-menu {
187+
@include mixin.hover-background;
188+
189+
@media (prefers-color-scheme: light) {
190+
@include mixin.hover-background;
191+
}
192+
193+
@media (prefers-color-scheme: dark) {
194+
@include mixin.hover-background(rgb(0 0 0 / 80%), rgb(0 0 0 / 90%));
195+
}
196+
}
197+
</style>

src/components/container/ContainerComponent.ce.vue

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<script setup lang="ts">
22
import {
33
darkTheme,
4+
type GlobalThemeOverrides,
45
lightTheme,
56
NConfigProvider,
67
NLoadingBarProvider,
@@ -21,12 +22,16 @@ const AppComponent = lazyComponent(() => import('~/components/AppComponent.vue')
2122
const isDark = watchPreferDark();
2223
const theme = computed(() => (isDark.value ? darkTheme : lightTheme));
2324
25+
const override: GlobalThemeOverrides = {
26+
// TODO red palette
27+
};
28+
2429
const root = ref<HTMLElement>();
2530
</script>
2631

2732
<template>
2833
<div id="trakt-extension-root" ref="root">
29-
<NConfigProvider :theme="theme" abstract>
34+
<NConfigProvider :theme="theme" :theme-overrides="override" abstract>
3035
<AppComponent />
3136

3237
<NLoadingBarProvider
@@ -48,7 +53,7 @@ const root = ref<HTMLElement>();
4853
</template>
4954

5055
<style lang="scss">
51-
@import '~/styles/base.css';
56+
@use '~/styles/base.scss';
5257
5358
:host {
5459
display: flex;

src/components/views/history/HistoryNavbar.vue

+9-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,15 @@ const onDateChange = debounce((values?: [number, number]) => {
8989
@use '~/styles/mixin' as mixin;
9090
9191
.n-date-panel {
92-
@include mixin.hover-background(rgb(0 0 0 / 80%), rgb(0 0 0 / 90%));
92+
@include mixin.hover-background;
93+
94+
@media (prefers-color-scheme: light) {
95+
@include mixin.hover-background;
96+
}
97+
98+
@media (prefers-color-scheme: dark) {
99+
@include mixin.hover-background(rgb(0 0 0 / 80%), rgb(0 0 0 / 90%));
100+
}
93101
94102
margin-top: 12px;
95103
margin-left: -16px;

src/styles/base.css src/styles/base.scss

+12-4
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818

1919
/* ui color variables */
2020
--bg-blur: 2px;
21-
--bg-blur-black: rgb(0 0 0 / 30%);
22-
--bg-blur-black-hover: rgb(0 0 0 / 60%);
21+
--bg-blur-bg: rgb(0 0 0 / 30%);
22+
--bg-blur-bg-hover: rgb(0 0 0 / 60%);
2323

2424
/* trakt.tv brand color */
2525
--trakt-red: #ed1c24;
@@ -45,9 +45,13 @@
4545
--color-border: var(--vt-c-divider-dark-2);
4646
--color-border-hover: var(--vt-c-divider-dark-1);
4747
--color-heading: var(--vt-c-text-dark-1);
48-
--color-text: var(--vt-c-text-dark-2)
48+
--color-text: var(--vt-c-text-dark-2);
49+
50+
/* ui color variables */
51+
--bg-blur-bg: rgb(0 0 0 / 30%);
52+
--bg-blur-bg-hover: rgb(0 0 0 / 60%);
4953
}
50-
54+
5155
@media (prefers-color-scheme: light) {
5256
--color-background: var(--vt-c-white);
5357
--color-background-soft: var(--vt-c-white-soft);
@@ -56,6 +60,10 @@
5660
--color-border-hover: var(--vt-c-divider-light-1);
5761
--color-heading: var(--vt-c-text-light-1);
5862
--color-text: var(--vt-c-text-light-1);
63+
64+
/* ui color variables */
65+
--bg-blur-bg: rgba(255 222 223 / 80%);
66+
--bg-blur-bg-hover: rgba(255 222 223 / 90%);
5967
}
6068
}
6169

src/styles/mixin.scss

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@mixin hover-background(
2-
$from: var(--bg-blur-black),
3-
$to: var(--bg-blur-black-hover),
2+
$from: var(--bg-blur-bg),
3+
$to: var(--bg-blur-bg-hover),
44
$blur: var(--bg-blur),
55
$transition: 0.5s var(--n-bezier)
66
) {

0 commit comments

Comments
 (0)