Skip to content

Commit 45448ed

Browse files
committed
Add color scheme
1 parent a5da30c commit 45448ed

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

packages/smooth-code/src/code-tween.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
getCodeColors,
1010
getColor,
1111
ColorName,
12+
getColorScheme
1213
} from "@code-hike/utils"
1314
import {
1415
useStepParser,
@@ -146,6 +147,7 @@ function AfterDimensions({
146147
opacity: 1,
147148
backgroundColor: bg,
148149
color: fg,
150+
["color-scheme" as any]: getColorScheme(theme),
149151
["--ch-selection-background" as any]: getColor(
150152
theme,
151153
ColorName.SelectionBackground

packages/utils/src/theme.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,16 @@ export function getColor(
203203
}
204204
}
205205

206+
export function getColorScheme(theme: EditorTheme): string | undefined {
207+
const themeType = getThemeType(theme)
208+
if (themeType === "dark") {
209+
return "dark"
210+
} else if (themeType === "light") {
211+
return "light"
212+
}
213+
return undefined
214+
}
215+
206216
export function transparent(
207217
color: Color,
208218
opacity: number

0 commit comments

Comments
 (0)