File tree 2 files changed +27
-2
lines changed
2 files changed +27
-2
lines changed Original file line number Diff line number Diff line change @@ -5,12 +5,14 @@ The syntax highlighter used by Code Hike.
5
5
``` js
6
6
import { highlight } from " @code-hike/lighter" ;
7
7
8
- const { lines , colors } = await highlight (
8
+ const { lines , style } = await highlight (
9
9
/* code */ " print('hello')" ,
10
10
/* lang */ " py" ,
11
11
/* theme */ " github-dark"
12
12
);
13
- const { foreground , background } = colors;
13
+
14
+ // base foreground and background
15
+ const { color , background } = style;
14
16
15
17
console .log (lines);
16
18
```
@@ -28,6 +30,16 @@ Output:
28
30
]
29
31
```
30
32
33
+ For ** dark/light theme support with CSS** see [ #25 ] ( https://github.com/code-hike/lighter/pull/25 )
34
+
35
+ For more theme colors (like line number foreground, selection background, etc.):
36
+
37
+ ``` js
38
+ import { getThemeColors } from " @code-hike/lighter" ;
39
+
40
+ const themeColors = await getThemeColors (" material-darker" );
41
+ ```
42
+
31
43
## Credits
32
44
33
45
- Using [ vscode-oniguruma] ( https://github.com/microsoft/vscode-oniguruma ) for highlighting
Original file line number Diff line number Diff line change
1
+ import { highlight } from "@code-hike/lighter" ;
2
+
3
+ const { lines, style } = await highlight (
4
+ /* code */ "print('hello')" ,
5
+ /* lang */ "py" ,
6
+ /* theme */ "github-dark"
7
+ ) ;
8
+
9
+ // base foreground and background
10
+ const { color, background } = style ;
11
+
12
+ console . log ( color , background ) ;
13
+ console . log ( lines ) ;
You can’t perform that action at this time.
0 commit comments