mirror of
https://github.com/lutinglt/gitea-github-theme.git
synced 2025-10-26 21:20:31 +00:00
src 结构调整, 添加 functions
This commit is contained in:
29
src/types/vars.ts
Normal file
29
src/types/vars.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { createGlobalThemeContract } from "@vanilla-extract/css";
|
||||
import * as color from "./color";
|
||||
|
||||
export function varMapper(value: string | null, path: string[]) {
|
||||
if (value === null) {
|
||||
path = path.filter(item => item !== "self");
|
||||
path = path.map(item => item.replace(/^num/, ""));
|
||||
return path.join("-");
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
const vars = {
|
||||
/** 用于标识当前是否为暗色主题: `"true"` 暗色 `"false"` 亮色 */
|
||||
isDarkTheme: "is-dark-theme",
|
||||
color: {
|
||||
blue: null,
|
||||
primary: color.primary,
|
||||
},
|
||||
};
|
||||
|
||||
const otherVars = {
|
||||
border: {
|
||||
radius: null,
|
||||
},
|
||||
};
|
||||
|
||||
export const themeVars = createGlobalThemeContract(vars, varMapper);
|
||||
export const otherThemeVars = createGlobalThemeContract(otherVars, varMapper);
|
||||
Reference in New Issue
Block a user