Skip to content

Commit c5cde8c

Browse files
committed
docs: add custom theme with dark mode default
Add blue accent colors and set dark mode as the default theme. The theme preference is stored in localStorage and can be toggled by users. Custom CSS provides blue accent colors matching React Native branding for both light and dark modes.
1 parent 17e2374 commit c5cde8c

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

docs/astro.config.mjs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,22 @@ export default defineConfig({
1515
src: "./src/assets/logo.svg",
1616
},
1717
plugins: [starlightThemeRapide()],
18+
customCss: ["./src/styles/custom.css"],
19+
head: [
20+
{
21+
tag: "script",
22+
attrs: {},
23+
content: `
24+
(function() {
25+
const storedTheme = typeof localStorage !== 'undefined' && localStorage.getItem('starlight-theme');
26+
if (!storedTheme) {
27+
localStorage.setItem('starlight-theme', 'dark');
28+
document.documentElement.setAttribute('data-theme', 'dark');
29+
}
30+
})();
31+
`,
32+
},
33+
],
1834
social: [{ icon: "github", label: "GitHub", href: "https://github.com/mgcrea/react-native-tailwind" }],
1935
sidebar: [
2036
{

docs/src/styles/custom.css

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/* Custom theme colors - Blue accent */
2+
:root {
3+
/* Light mode accent colors */
4+
--sl-color-accent-low: #1e3a5f;
5+
--sl-color-accent: #3b82f6;
6+
--sl-color-accent-high: #60a5fa;
7+
}
8+
9+
/* Dark mode accent colors */
10+
:root[data-theme="dark"] {
11+
--sl-color-accent-low: #1e40af;
12+
--sl-color-accent: #3b82f6;
13+
--sl-color-accent-high: #93c5fd;
14+
}

0 commit comments

Comments
 (0)