Skip to content

Commit

Permalink
docs: fix highlighting for lighter themes (#2061)
Browse files Browse the repository at this point in the history
  • Loading branch information
metonym authored Nov 24, 2024
1 parent 5fe5db9 commit f752c96
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
6 changes: 3 additions & 3 deletions docs/src/components/ComponentApi.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
.default;
});
$: console.log(AsyncPreviewTypeScript);
const mdn_api = "https://developer.mozilla.org/en-US/docs/Web/API/";
const typeMap = {
string: "string",
Expand Down Expand Up @@ -314,7 +312,9 @@
}}
>
{#if full_code_prop}
Default value for <strong>{full_code_prop}</strong>.
<div style="margin-bottom: var(--cds-spacing-04);">
Default value for <strong>{full_code_prop}</strong>.
</div>
{/if}
{#if full_code}
<svelte:component
Expand Down
7 changes: 6 additions & 1 deletion docs/src/components/PreviewTypeScript.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,12 @@
{/if}

{#if type === "inline"}
<CodeSnippet type="inline" code={formattedCode} {copy}>
<CodeSnippet
type="inline"
class="code-override-inline"
code={formattedCode}
{copy}
>
{@html highlightedCode}
</CodeSnippet>
{/if}
11 changes: 11 additions & 0 deletions docs/src/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,17 @@ html[theme="g90"] .code-override {
color: #6ea6ff;
}

/* Override syntax highlighting for light theme inline code .*/
[theme="white"] .code-override-inline .token,
[theme="g10"] .code-override-inline .token {
color: var(--cds-text-01, #161616);
}

/** Gray 80 is the "lighted" dark theme. Ensure the background is dark. */
[theme="g80"] .code-override-inline {
background-color: #262626;
}

.token.builtin,
.token.attr-name {
color: #3ddbd9; /* teal 30 */
Expand Down

0 comments on commit f752c96

Please sign in to comment.