diff 页面同步 & Github 全局变量

This commit is contained in:
lutinglt
2025-06-28 23:19:37 +08:00
parent d2be94ee27
commit e113d1c603
10 changed files with 137 additions and 55 deletions

View File

@@ -1,6 +1,6 @@
import { rgba } from "polished";
import { scaleColorLight } from "src/functions";
import type { Ansi, Console, Diff, Message, Named, Other, Primary, Secondary } from "src/types";
import type { Ansi, Console, Diff, Github, Message, Named, Other, Primary, Secondary } from "src/types";
import { themeVars } from "src/types/vars";
import type { Theme } from "./theme";
@@ -51,6 +51,8 @@ interface ColorTheme {
diff: Diff;
/** 其他 */
other: Other;
/** 仅适用于本主题的全局变量, 取自 Github */
github: Github;
}
/** 定义颜色, 用于生成颜色主题
@@ -349,5 +351,6 @@ export function defineTheme(theme: ColorTheme): Theme {
...message,
...theme.other,
},
github: theme.github,
};
}

56
src/types/color/github.ts Normal file
View File

@@ -0,0 +1,56 @@
export const github = {
display: {
brown: { fgColor: null },
cyan: { fgColor: null },
indigo: { fgColor: null },
lemon: { fgColor: null },
olive: { fgColor: null },
teal: { fgColor: null },
},
diffBlob: {
addtionNum: {
bgColor: null,
},
addtionWord: {
bgColor: null,
},
deletionNum: {
bgColor: null,
},
deletionWord: {
bgColor: null,
},
hunkNum: {
/** diff 按钮色 */
bgColorRest: null,
},
},
fgColor: {
accent: null,
attention: null,
danger: null,
default: null,
disabled: null,
done: null,
neutral: null,
severe: null,
sponsors: null,
success: null,
black: null,
white: null,
},
bgColor: {
accent: {
emphasis: null,
muted: null,
},
black: null,
success: {
muted: null,
},
danger: {
muted: null,
},
muted: null,
},
};

View File

@@ -1,5 +1,6 @@
export { ansi, console } from "./console";
export { diff } from "./diff";
export { github } from "./github";
export { primary, secondary } from "./main";
export { message } from "./message";
export { named } from "./named";

View File

@@ -9,3 +9,4 @@ export type Ansi = MapLeafNodes<typeof color.ansi, string>;
export type Console = MapLeafNodes<typeof color.console, string>;
export type Diff = MapLeafNodes<typeof color.diff, string>;
export type Other = MapLeafNodes<typeof color.other, string>;
export type Github = MapLeafNodes<typeof color.github, string>;

View File

@@ -22,6 +22,7 @@ const vars = {
console: color.console,
diff: color.diff,
},
github: color.github,
};
const otherVars = {