Skip to content

Commit 60999f2

Browse files
committed
Update web test
1 parent 9f4d748 commit 60999f2

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

web/app/test/code.js

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { highlight } from "@code-hike/lighter";
1+
import { getThemeColors, highlight } from "@code-hike/lighter";
22

33
export async function Code({
44
children,
@@ -8,16 +8,11 @@ export async function Code({
88
lineNumbers,
99
theme,
1010
}) {
11-
const { lines, colors } = await highlight(children, lang, theme);
12-
// console.log({ colors });
11+
const { lines, style: s } = await highlight(children, lang, theme);
1312

14-
const {
15-
foreground,
16-
background,
17-
colorScheme,
18-
selectionBackground,
19-
lineNumberForeground,
20-
} = colors;
13+
const colors = await getThemeColors(theme);
14+
15+
const { color, background } = s;
2116

2217
const lineCount = lines.length;
2318
const digits = lineCount.toString().length;
@@ -44,21 +39,21 @@ export async function Code({
4439
<pre
4540
className={className}
4641
style={{
47-
color: foreground,
42+
color,
4843
background,
4944
// border: "1px solid " + background,
5045
padding: "1em",
5146
borderRadius: "4px",
52-
colorScheme,
47+
// colorScheme,
5348
...style,
5449
}}
5550
>
5651
<style>{`
5752
code ::selection {
58-
background-color: ${selectionBackground}
53+
background-color: ${colors.editor.selectionBackground};
5954
}
6055
.bright-ln {
61-
color: ${lineNumberForeground};
56+
color: ${colors.editorLineNumber.foreground};
6257
padding-right: 2ch;
6358
display: inline-block;
6459
text-align: right;

0 commit comments

Comments
 (0)