Skip to content

Commit 253308d

Browse files
committed
Custom shiki theme.
1 parent a8c6cef commit 253308d

File tree

6 files changed

+76
-18
lines changed

6 files changed

+76
-18
lines changed

docs/site/app/global.css

+22
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,24 @@ code {
133133
--vaul-overlay-background: 255, 255, 255;
134134
--vaul-overlay-background-start: rgba(0, 0, 0, 0);
135135
--vaul-overlay-background-end: rgba(0, 0, 0, 0.4);
136+
137+
pre {
138+
--shiki-color-text: var(--ds-gray-1000);
139+
--shiki-background: transparent;
140+
--shiki-token-constant: var(--ds-blue-900);
141+
--shiki-token-string: var(--ds-green-900);
142+
--shiki-token-comment: var(--ds-gray-900);
143+
--shiki-token-keyword: var(--ds-pink-900);
144+
--shiki-token-parameter: var(--ds-amber-900);
145+
--shiki-token-function: var(--ds-purple-900);
146+
--shiki-token-string-expression: var(--ds-green-900);
147+
--shiki-token-punctuation: var(--ds-gray-1000);
148+
--shiki-token-link: var(--ds-green-900);
149+
--shiki-token-inserted: var(--ds-green-900);
150+
--shiki-token-deleted: var(--ds-red-900);
151+
152+
background: black;
153+
}
136154
}
137155

138156
:root,
@@ -253,6 +271,10 @@ code {
253271

254272
--ds-background-100: hsla(var(--ds-background-100-value), 1);
255273
--ds-background-200: hsla(var(--ds-background-200-value), 1);
274+
275+
pre {
276+
background: white;
277+
}
256278
}
257279

258280
.dark,

docs/site/lib/nav-links.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
import type { LinkItemType } from "fumadocs-ui/layouts/links";
77

88
export const navLinks: LinkItemType[] = [
9+
{ url: "/repo/docs", text: "Docs", icon: <BookOpenIcon /> },
910
{ url: "/blog", text: "Blog", icon: <BookOpenIcon /> },
1011
{ url: "/showcase", text: "Showcase", icon: <StarIcon /> },
1112
{

docs/site/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
"remark-mdx": "^3.1.0",
4747
"remark-stringify": "^11.0.0",
4848
"semver": "^7.3.8",
49+
"shiki": "^3.1.0",
4950
"swr": "2.2.6-beta.0",
5051
"zod": "^3.24.2"
5152
},

docs/site/source.config.ts

+17-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
frontmatterSchema,
55
} from "fumadocs-mdx/config";
66
import { z } from "zod";
7+
import { createCssVariablesTheme } from "shiki";
78

89
export const { docs: repoDocs, meta: repoMeta } = defineDocs({
910
dir: "content/repo-docs",
@@ -51,5 +52,20 @@ export const { docs: openapiDocs, meta: openapiMeta } = defineDocs({
5152
dir: "content/openapi",
5253
});
5354

55+
const theme = createCssVariablesTheme({
56+
name: "css-variables",
57+
variablePrefix: "--shiki-",
58+
variableDefaults: {},
59+
});
60+
5461
// eslint-disable-next-line import/no-default-export
55-
export default defineConfig();
62+
export default defineConfig({
63+
mdxOptions: {
64+
rehypeCodeOptions: {
65+
themes: {
66+
light: theme,
67+
dark: theme,
68+
},
69+
},
70+
},
71+
});

docs/site/turbo.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
},
4444
"write-private-files": {
4545
"cache": false,
46-
"env": ["SITE_ANALYTICS_MODULE_CODE", "SITE_ANALYTICS_MODULE_CODE"]
46+
"env": ["SITE_ANALYTICS_MODULE_CODE", "MIDDLEWARE_MODULE_CODE"]
4747
},
4848
"index-docs": {
4949
"dependsOn": ["build"],

pnpm-lock.yaml

+34-16
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)