Skip to content

Commit 64ac30f

Browse files
committed
Add dark theme styles for DocSearch modal
Introduce dark-mode CSS for the DocSearch modal by adding a set of CSS custom properties under [data-theme="dark"] .DocSearch-Modal (colors, backgrounds, shadows, muted/logo colors, footer and hit styles). Also style command/escape keys for dark mode and tweak .DocSearch-Button-Key dark variant to use black text on white background with white border to improve contrast in dark theme.
1 parent 97fea1c commit 64ac30f

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

src/styles/tailwind.css

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,33 @@
3535
:root {
3636
--docsearch-primary-color: #1d78c1 !important;
3737
}
38+
39+
[data-theme="dark"] .DocSearch-Modal {
40+
--docsearch-text-color: #d8dee9;
41+
--docsearch-container-background: rgba(4, 6, 12, 0.78);
42+
--docsearch-modal-background: #060a14;
43+
--docsearch-modal-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
44+
--docsearch-searchbox-background: #090f1c;
45+
--docsearch-searchbox-focus-background: #0f172a;
46+
--docsearch-hit-background: #0a1020;
47+
--docsearch-hit-color: #d1d5db;
48+
--docsearch-hit-shadow: none;
49+
--docsearch-footer-background: #090f1c;
50+
--docsearch-footer-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.06);
51+
--docsearch-muted-color: #9aa5bb;
52+
--docsearch-logo-color: #f8fafc;
53+
}
54+
55+
[data-theme="dark"] .DocSearch-Modal .DocSearch-Commands-Key {
56+
background: #ffffff;
57+
color: #000000;
58+
border: 1px solid #ffffff;
59+
}
60+
61+
[data-theme="dark"] .DocSearch-Modal .DocSearch-Escape-Key {
62+
color: #000000;
63+
}
64+
3865
.DocSearch-Button {
3966
@apply bg-transparent! lg:bg-gray-500! transition! duration-200! lg:rounded-full!;
4067
}
@@ -48,7 +75,7 @@
4875
@apply hidden! lg:flex!;
4976
}
5077
.DocSearch-Button-Key {
51-
@apply text-gray-700! bg-gray-100! border-gray-300! dark:text-gray-900! dark:bg-gray-200! dark:border-gray-400!;
78+
@apply text-gray-700! bg-gray-100! border-gray-300! dark:text-black! dark:bg-white! dark:border-white!;
5279
}
5380
.DocSearch-Button .DocSearch-Search-Icon {
5481
@apply text-white! lg:text-gray-100!;

0 commit comments

Comments
 (0)