File tree 1 file changed +9
-14
lines changed
1 file changed +9
-14
lines changed Original file line number Diff line number Diff line change 1
- import { highlight } from "@code-hike/lighter" ;
1
+ import { getThemeColors , highlight } from "@code-hike/lighter" ;
2
2
3
3
export async function Code ( {
4
4
children,
@@ -8,16 +8,11 @@ export async function Code({
8
8
lineNumbers,
9
9
theme,
10
10
} ) {
11
- const { lines, colors } = await highlight ( children , lang , theme ) ;
12
- // console.log({ colors });
11
+ const { lines, style : s } = await highlight ( children , lang , theme ) ;
13
12
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 ;
21
16
22
17
const lineCount = lines . length ;
23
18
const digits = lineCount . toString ( ) . length ;
@@ -44,21 +39,21 @@ export async function Code({
44
39
< pre
45
40
className = { className }
46
41
style = { {
47
- color : foreground ,
42
+ color,
48
43
background,
49
44
// border: "1px solid " + background,
50
45
padding : "1em" ,
51
46
borderRadius : "4px" ,
52
- colorScheme,
47
+ // colorScheme,
53
48
...style ,
54
49
} }
55
50
>
56
51
< style > { `
57
52
code ::selection {
58
- background-color: ${ selectionBackground }
53
+ background-color: ${ colors . editor . selectionBackground } ;
59
54
}
60
55
.bright-ln {
61
- color: ${ lineNumberForeground } ;
56
+ color: ${ colors . editorLineNumber . foreground } ;
62
57
padding-right: 2ch;
63
58
display: inline-block;
64
59
text-align: right;
You can’t perform that action at this time.
0 commit comments