Skip to content

Commit cbfa216

Browse files
committed
Update readme
1 parent 60999f2 commit cbfa216

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

readme.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@ The syntax highlighter used by Code Hike.
55
```js
66
import { highlight } from "@code-hike/lighter";
77

8-
const { lines, colors } = await highlight(
8+
const { lines, style } = await highlight(
99
/* code */ "print('hello')",
1010
/* lang */ "py",
1111
/* theme */ "github-dark"
1212
);
13-
const { foreground, background } = colors;
13+
14+
// base foreground and background
15+
const { color, background } = style;
1416

1517
console.log(lines);
1618
```
@@ -28,6 +30,16 @@ Output:
2830
]
2931
```
3032

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+
3143
## Credits
3244

3345
- Using [vscode-oniguruma](https://github.com/microsoft/vscode-oniguruma) for highlighting

test/index.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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);

0 commit comments

Comments
 (0)