Skip to content

Improve codeblock highlight style #3048

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 26 additions & 26 deletions packages/gitbook/src/components/DocumentView/CodeBlock/theme.css
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
:root {
--shiki-color-text: theme("colors.tint.11");
--shiki-token-constant: #0a6355;
--shiki-token-string: #8b6d32;
--shiki-token-comment: theme("colors.teal.700/.64");
--shiki-token-keyword: theme("colors.pomegranate.600");
--shiki-token-parameter: #0a3069;
--shiki-token-function: #8250df;
--shiki-token-string-expression: #6a4906;
--shiki-token-punctuation: theme("colors.pomegranate.700/.92");
--shiki-token-link: theme("colors.tint.12");
--shiki-token-inserted: #22863a;
--shiki-token-deleted: #b31d28;
--shiki-token-changed: #8250df;
--shiki-color-text: #24292eff;
--shiki-token-constant: #1976d2;
--shiki-token-string: #2b5581;
--shiki-token-comment: #c2c3c5;
--shiki-token-keyword: #d32f2f;
--shiki-token-parameter: #ff9800;
--shiki-token-function: #6f42c1;
--shiki-token-string-expression: #22863a;
--shiki-token-punctuation: #212121;
--shiki-token-link: #22863a;
--shiki-token-inserted: #b7e7a44b;
--shiki-token-deleted: #e597af52;
--shiki-token-changed: #0000001a;
}

html.dark {
--shiki-color-text: theme("colors.tint.11");
--shiki-token-constant: #d19a66;
--shiki-token-string: theme("colors.pomegranate.300");
--shiki-token-comment: theme("colors.teal.300/.64");
--shiki-token-keyword: theme("colors.pomegranate.400");
--shiki-token-parameter: theme("colors.yellow.500");
--shiki-token-function: #56b6c2;
--shiki-token-string-expression: theme("colors.tint.11");
--shiki-token-punctuation: #acc6ee;
--shiki-token-link: theme("colors.pomegranate.400");
--shiki-token-inserted: #85e89d;
--shiki-token-deleted: #fdaeb7;
--shiki-token-changed: #56b6c2;
--shiki-color-text: #eeffff;
--shiki-token-constant: #82aaff;
--shiki-token-string: #82aaff;
--shiki-token-comment: #676767;
--shiki-token-keyword: #c792ea;
--shiki-token-parameter: #f07178;
--shiki-token-function: #ffcb6b;
--shiki-token-string-expression: #c3e88d;
--shiki-token-punctuation: #89ddff;
--shiki-token-link: #80cbc4;
--shiki-token-inserted: #c3e88d;
--shiki-token-deleted: #f07178;
--shiki-token-changed: #ffcb6b;
}
16 changes: 13 additions & 3 deletions packages/gitbook/src/components/DocumentView/OpenAPI/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@

/* Code Sample */
.openapi-codesample {
@apply border rounded bg-tint border-tint-subtle;
@apply border rounded bg-tint-subtle theme-gradient:bg-tint-12/1 border-tint-subtle;
}

.openapi-codesample-header {
Expand Down Expand Up @@ -458,11 +458,11 @@

/* Response Example */
.openapi-response-example {
@apply border rounded bg-tint border-tint-subtle;
@apply border rounded bg-tint-subtle theme-gradient:bg-tint-12/1 border-tint-subtle;
}

.openapi-response-example-empty {
@apply relative text-tint bg-tint min-h-20 flex flex-col justify-center items-center;
@apply relative text-tint bg-tint-subtle theme-gradient:bg-tint-12/1 min-h-20 flex flex-col justify-center items-center;
}

/* Common Elements */
Expand Down Expand Up @@ -692,3 +692,13 @@
opacity: 0;
}
}

.openapi-codesample pre,
.openapi-response-example pre {
@apply !bg-tint-subtle theme-gradient:!bg-transparent;
}

.openapi-codesample pre .highlight-line-content,
.openapi-response-example pre .highlight-line-content {
@apply !text-[0.8125rem] !leading-5;
}