Skip to content

Commit efa7caa

Browse files
authored
Merge pull request #129 from code-hike/fix-dependencies
Add `color-scheme` CSS
2 parents 846fec0 + 45448ed commit efa7caa

File tree

5 files changed

+51
-303
lines changed

5 files changed

+51
-303
lines changed

packages/mdx/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
"@code-hike/smooth-code": "^0.3.0-next.0",
3030
"@code-hike/utils": "^0.3.0-next.0",
3131
"@codesandbox/sandpack-client": "^0.1.20",
32-
"estree-util-value-to-estree": "^1.3.0",
3332
"hast-util-to-estree": "^1.4.0",
33+
"is-plain-obj": "^3.0.0",
3434
"node-fetch": "^2.0.0",
3535
"remark-rehype": "^8.1.0",
3636
"unified": "^9.2.2",

packages/script/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"autoprefixer": "^9.8.2",
1111
"cssnano": "^4.1.10",
1212
"edit-json-file": "^1.5.0",
13-
"node-sass": "^5.0.0",
13+
"node-sass": "^6.0.0",
1414
"rollup": "^2.41.2",
1515
"rollup-plugin-copy": "^3.3.0",
1616
"rollup-plugin-postcss": "^4.0.0",

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)