Skip to content

Commit f2175c3

Browse files
committed
fix: theme selector
1 parent 8cd9e2e commit f2175c3

File tree

2 files changed

+35
-10
lines changed

2 files changed

+35
-10
lines changed

packages/assets/styles/variables.scss

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
:root {
2-
--color-bg: var(--surface-l1);
3-
--color-raised-bg: var(--surface-l3);
4-
--color-super-raised-bg: var(--surface-l4);
5-
}
6-
71
.light-properties {
82
--surface-l1: #ebebeb;
93
--surface-l2: #ffffff;
104
--surface-l3: #f5f5f5;
115
--surface-l4: #eeeeee;
126
--surface-l5: #e6e6e6;
137

14-
--color-button-bg: #f5f5f5;
8+
--color-bg: var(--surface-l1);
9+
--color-raised-bg: var(--surface-l3);
10+
--color-super-raised-bg: var(--surface-l4);
11+
12+
--color-button-bg: var(--surface-l4);
1513
--color-button-border: rgba(161, 161, 161, 0.35);
1614
--color-scrollbar: #96a2b0;
1715

@@ -148,7 +146,11 @@ html {
148146
--surface-l4: #34363c;
149147
--surface-l5: #42444a;
150148

151-
--color-button-bg: #33363d;
149+
--color-bg: var(--surface-l1);
150+
--color-raised-bg: var(--surface-l3);
151+
--color-super-raised-bg: var(--surface-l4);
152+
153+
--color-button-bg: var(--surface-l4);
152154
--color-button-border: rgba(193, 190, 209, 0.12);
153155
--color-scrollbar: var(--color-button-bg);
154156

packages/ui/src/components/settings/ThemeSelector.vue

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { defineMessages, useVIntl } from '@vintl/vintl'
44
55
const { formatMessage } = useVIntl()
66
7-
defineProps<{
7+
const { updateColorTheme, currentTheme, themeOptions, systemThemeColor } = defineProps<{
88
updateColorTheme: (theme: T) => void
99
currentTheme: T
1010
themeOptions: readonly T[]
@@ -53,6 +53,11 @@ const colorTheme = defineMessages({
5353
function asString(theme: T): string {
5454
return theme
5555
}
56+
57+
function getPreviewClass(option: T): string {
58+
const base = option === 'system' ? systemThemeColor : option
59+
return base.endsWith('-mode') ? base : `${base}-mode`
60+
}
5661
</script>
5762

5863
<template>
@@ -64,7 +69,7 @@ function asString(theme: T): string {
6469
:class="{ selected: currentTheme === option }"
6570
@click="() => updateColorTheme(option)"
6671
>
67-
<div class="preview" :class="`${option === 'system' ? systemThemeColor : option}-mode`">
72+
<div class="preview" :class="getPreviewClass(option)">
6873
<div class="example-card card card">
6974
<div class="example-icon"></div>
7075
<div class="example-text-1"></div>
@@ -96,6 +101,24 @@ function asString(theme: T): string {
96101
grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
97102
gap: var(--gap-lg);
98103
104+
.preview {
105+
&.light-mode {
106+
@extend .light-mode;
107+
}
108+
109+
&.dark-mode {
110+
@extend .dark-mode;
111+
}
112+
113+
&.oled-mode {
114+
@extend .oled-mode;
115+
}
116+
117+
&.retro-mode {
118+
@extend .retro-mode;
119+
}
120+
}
121+
99122
.preview .example-card {
100123
margin: 0;
101124
padding: 1rem;

0 commit comments

Comments
 (0)