Skip to content

Commit

Permalink
Fix the syntax highlighting color in the ref doc
Browse files Browse the repository at this point in the history
  • Loading branch information
quadratz committed May 29, 2024
1 parent 8cfca9b commit f3e487b
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 16 deletions.
4 changes: 3 additions & 1 deletion site/api/components/Class/Constructors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ export function Constructors({
{v.accessibility
? <StyleKw>{v.accessibility}{" "}</StyleKw>
: undefined}
<span style="color: rgb(98, 232, 132);">{v.name}</span>(
<span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">
{v.name}
</span>(
<Params getLink={getLink}>{v.params}</Params>);
</CodeBlock>
{"jsDoc" in v && <P doc>{v.jsDoc?.doc}</P>}
Expand Down
16 changes: 13 additions & 3 deletions site/api/components/Class/Method.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,23 @@ export function Def(
return (
<>
{method.kind == "setter"
? <span style="color: #F286C4;">set{" "}</span>
? (
<span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">
set{" "}
</span>
)
: method.kind == "getter"
? <span style="color: #F286C4;">get{" "}</span>
? (
<span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">
get{" "}
</span>
)
: (
""
)}
<span style="color: #62E884">{method.name}</span>
<span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">
{method.name}
</span>
<TypeParams_ getLink={getLink}>
{typeParams}
</TypeParams_>(
Expand Down
10 changes: 5 additions & 5 deletions site/api/components/CodeBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ export function CodeBlock({ children }: { children?: ComponentChildren }) {
return (
<>
{"\n\n"}
<div class="language-ts">
{"\n\n"}
<pre class="shiki dracula-soft">
<code>{children}</code>
<div class="language-ts vp-adaptive-theme">
<button title="Copy Code" class="copy"></button>
<span class="lang">ts</span>
<pre class="shiki shiki-themes github-light github-dark vp-code">
<code style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">{children}</code>
</pre>
{"\n\n"}
</div>
{"\n\n"}
</>
Expand Down
4 changes: 2 additions & 2 deletions site/api/components/PropertyName.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ export function PropertyName({
}) {
return (
<>
<span style={klass ? "" : "color:#FFB86C;font-style:italic;"}>
<span style={klass ? "" : "--shiki-light:#24292E;--shiki-dark:#E1E4E8;"}>
{name}
</span>
{(optional || hasType) && (
<span style="color:#F286C4;">
<span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">
{optional && <>?</>}
{hasType && <>:</>}
</span>
Expand Down
18 changes: 13 additions & 5 deletions site/api/components/styles.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,33 @@
import { ComponentChildren } from "preact";

export function StyleKw({ children }: { children?: ComponentChildren }) {
return <span style="color:#F286C4;">{children}</span>;
return (
<span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">{children}</span>
);
}

export function StyleStrLit({ children }: { children?: ComponentChildren }) {
return <span style="color:#E7EE98;">{children}</span>;
return (
<span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">{children}</span>
);
}

export function StyleTypeRef({ children }: { children?: ComponentChildren }) {
return (
<span style="color:#97E1F1;font-style:italic;">
<span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">
{children}
</span>
);
}

export function StyleCallee({ children }: { children?: ComponentChildren }) {
return <span style="color:#62E884">{children}</span>;
return (
<span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">{children}</span>
);
}

export function StyleNum({ children }: { children?: ComponentChildren }) {
return <span style="color:#BF9EEE">{children}</span>;
return (
<span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">{children}</span>
);
}

0 comments on commit f3e487b

Please sign in to comment.