feat(chroma): 代码高亮重构

This commit is contained in:
lutinglt
2025-08-07 19:21:12 +08:00
parent 065d7893d8
commit cf907321ef
2 changed files with 2 additions and 12 deletions

View File

@@ -57,7 +57,7 @@ type ThemeColor = {
/** 定义颜色, 用于生成颜色主题
* @example
* 文件名: "dark.css.tsx"
* 文件名: "dark.css.ts"
* import type { Console, Diff, Other } from "src/types";
* import { defineTheme, themeVars } from "src";
*
@@ -70,7 +70,6 @@ type ThemeColor = {
* ...
* }
* ...
* // 会经过 lightningcss 打包处理生成最终的 CSS
* export default defineTheme({
* isDarkTheme: true,
* primary: "#0969da",

View File

@@ -4,15 +4,6 @@ import type { MapLeafNodes, WithOptionalLayer } from "./types";
export type Theme = WithOptionalLayer<MapLeafNodes<typeof themeVars, string>>;
function stringToBoolean(str: string, name: string): boolean {
try {
return JSON.parse(str);
} catch (error) {
console.error(error);
throw new Error(`Invalid boolean value(${name}): ${str}`);
}
}
export const overlayAppearDown = "overlay-appear-down";
export const animationDown = `200ms cubic-bezier(0.33, 1, 0.68, 1) 0s 1 normal none running ${overlayAppearDown}`;
export const overlayAppearUp = "overlay-appear-up";
@@ -42,7 +33,7 @@ const emoji = `
`;
export function createTheme(theme: Theme): void {
const isDarkTheme = stringToBoolean(theme.isDarkTheme, "isDarkTheme");
const isDarkTheme: boolean = JSON.parse(theme.isDarkTheme);
if (isDarkTheme) {
globalStyle(emoji, { filter: "invert(100%) hue-rotate(180deg)" });
}