mirror of
https://github.com/lutinglt/gitea-github-theme.git
synced 2025-10-28 07:00:32 +00:00
feat(chroma): 代码高亮重构
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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)" });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user