mirror of
https://github.com/lutinglt/gitea-github-theme.git
synced 2025-10-28 15:20:30 +00:00
支持猛男粉颜色主题
This commit is contained in:
77
src/core/display.ts
Normal file
77
src/core/display.ts
Normal file
@@ -0,0 +1,77 @@
|
||||
import { type GithubColor } from "./github";
|
||||
|
||||
export type DisplayColor = {
|
||||
num0: string;
|
||||
num1: string;
|
||||
num2: string;
|
||||
num3: string;
|
||||
num4: string;
|
||||
num5: string;
|
||||
num6: string;
|
||||
num7: string;
|
||||
num8: string;
|
||||
num9: string;
|
||||
};
|
||||
|
||||
export function display2GithubColor(
|
||||
displayColor: DisplayColor,
|
||||
baseGithubColor: GithubColor,
|
||||
soft?: boolean
|
||||
): GithubColor {
|
||||
return {
|
||||
...baseGithubColor,
|
||||
fgColor: {
|
||||
...baseGithubColor.fgColor,
|
||||
accent: soft ? displayColor.num7 : displayColor.num6,
|
||||
},
|
||||
bgColor: {
|
||||
...baseGithubColor.bgColor,
|
||||
accent: {
|
||||
emphasis: displayColor.num5,
|
||||
muted: soft ? displayColor.num1 : displayColor.num0,
|
||||
},
|
||||
},
|
||||
borderColor: {
|
||||
...baseGithubColor.borderColor,
|
||||
accent: {
|
||||
emphasis: soft ? displayColor.num6 : displayColor.num5,
|
||||
},
|
||||
},
|
||||
button: {
|
||||
...baseGithubColor.button,
|
||||
primary: {
|
||||
...baseGithubColor.button.primary,
|
||||
fgColor: {
|
||||
...baseGithubColor.button.primary.fgColor,
|
||||
accent: soft ? displayColor.num6 : displayColor.num5,
|
||||
},
|
||||
bgColor: {
|
||||
...baseGithubColor.button.primary.bgColor,
|
||||
rest: displayColor.num5,
|
||||
hover: displayColor.num4,
|
||||
},
|
||||
},
|
||||
star: {
|
||||
iconColor: soft ? displayColor.num6 : displayColor.num5,
|
||||
},
|
||||
},
|
||||
underlineNav: {
|
||||
borderColor: {
|
||||
active: soft ? displayColor.num6 : displayColor.num5,
|
||||
},
|
||||
},
|
||||
contribution: {
|
||||
...baseGithubColor.contribution,
|
||||
default: {
|
||||
...baseGithubColor.contribution.default,
|
||||
bgColor: {
|
||||
num0: baseGithubColor.contribution.default.bgColor.num0,
|
||||
num1: soft ? displayColor.num2 : displayColor.num1,
|
||||
num2: soft ? displayColor.num3 : displayColor.num2,
|
||||
num3: soft ? displayColor.num5 : displayColor.num4,
|
||||
num4: soft ? displayColor.num7 : displayColor.num6,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user