Skip to content

Commit b9390c5

Browse files
committed
fix: selection bg in dark mode
Signed-off-by: Innei <[email protected]>
1 parent 5630729 commit b9390c5

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

src/components/modules/shared/AccentColorStyleInjector.tsx

+7-2
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ export async function AccentColorStyleInjector({
4949
const [hl, sl, ll] = lightOklch
5050
const [hd, sd, ld] = darkOklch
5151

52+
const [lightBgImage, darkBgImage] = await Promise.all([
53+
createPngNoiseBackground(currentAccentColorLRef),
54+
createPngNoiseBackground(currentAccentColorDRef),
55+
])
56+
5257
return (
5358
<style
5459
id="accent-color-style"
@@ -57,10 +62,10 @@ export async function AccentColorStyleInjector({
5762
dangerouslySetInnerHTML={{
5863
__html: `
5964
html[data-theme='light'].noise body::before {
60-
background-image: ${await createPngNoiseBackground(currentAccentColorLRef)}
65+
background-image: ${lightBgImage}
6166
}
6267
html[data-theme='dark'].noise body::before {
63-
background-image: ${await createPngNoiseBackground(currentAccentColorDRef)}
68+
background-image: ${darkBgImage}
6469
}
6570
html[data-theme='light'] {
6671
--a: ${`${hl} ${sl} ${ll}`};

src/styles/variables.css

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
html {
2-
--border-color: #eee;
32
--font-sans: theme('fontFamily.sans');
4-
--theme-color: var(--auto-theme-color, theme('colors.accent'));
5-
--hover-color: var(--auto-hover-color, theme('colors.accent/80'));
6-
--header-height: auto;
3+
74
/* Accent color for form controls */
8-
accent-color: var(--theme-color);
5+
accent-color: theme(colors.accent);
96

107
/* make app like native app in mobile */
118
-webkit-tap-highlight-color: transparent;
@@ -27,11 +24,15 @@ details summary {
2724
}
2825

2926
::selection {
30-
background-color: var(--theme-color) !important;
27+
background-color: theme(colors.accent);
3128
color: theme(colors.white) !important;
3229
text-shadow: none;
3330
}
3431

32+
[data-theme='dark'] ::selection {
33+
background-color: theme(colors.accent/0.3);
34+
}
35+
3536
::view-transition-new(root) {
3637
animation: turnOff 800ms ease-in-out;
3738
}

0 commit comments

Comments
 (0)