代码整理

This commit is contained in:
lutinglt
2025-08-11 17:56:39 +08:00
parent 00eda68f00
commit 9f2e5df49c
8 changed files with 48 additions and 231 deletions

View File

@@ -39,107 +39,40 @@ export type GithubColor = {
muted: string; muted: string;
}; };
bgColor: { bgColor: {
accent: { accent: { emphasis: string; muted: string };
emphasis: string; attention: { muted: string };
muted: string; success: { emphasis: string; muted: string };
}; danger: { muted: string };
attention: { done: { emphasis: string };
muted: string;
};
success: {
emphasis: string;
muted: string;
};
danger: {
muted: string;
};
done: {
emphasis: string;
};
default: string; default: string;
inset: string; inset: string;
muted: string; muted: string;
neutral: { neutral: { muted: string };
muted: string;
};
}; };
borderColor: { borderColor: {
accent: { accent: { emphasis: string };
emphasis: string; attention: { emphasis: string };
};
attention: {
emphasis: string;
};
default: string; default: string;
success: { success: { emphasis: string };
emphasis: string; done: { emphasis: string };
};
done: {
emphasis: string;
};
muted: string; muted: string;
translucent: string; translucent: string;
}; };
button: { button: {
primary: { primary: { fgColor: { rest: string }; bgColor: { hover: string } };
fgColor: { danger: { fgColor: { rest: string; hover: string }; bgColor: { hover: string } };
rest: string;
};
bgColor: {
hover: string;
};
};
danger: {
fgColor: {
rest: string;
hover: string;
};
bgColor: {
hover: string;
};
};
}; };
control: { control: {
bgColor: { bgColor: { active: string; hover: string; rest: string };
active: string; transparent: { bgColor: { active: string; hover: string; selected: string } };
hover: string;
rest: string;
};
transparent: {
bgColor: {
active: string;
hover: string;
selected: string;
};
};
};
shadow: {
floating: {
small: string;
};
};
overlay: {
backdrop: {
bgColor: string;
};
};
underlineNav: {
borderColor: {
active: string;
};
}; };
shadow: { floating: { small: string } };
overlay: { backdrop: { bgColor: string } };
underlineNav: { borderColor: { active: string } };
contribution: { contribution: {
default: { default: {
bgColor: { bgColor: { num0: string; num1: string; num2: string; num3: string; num4: string };
num0: string; borderColor: { num0: string };
num1: string;
num2: string;
num3: string;
num4: string;
};
borderColor: {
num0: string;
};
}; };
}; };
}; };

View File

@@ -2,47 +2,22 @@ import type { Chroma } from "src/types";
export type prettylightsColor = { export type prettylightsColor = {
syntax: { syntax: {
brackethighlighter: { brackethighlighter: { angle: string; unmatched: string };
angle: string; carriage: { return: { bg: string; text: string } };
unmatched: string;
};
carriage: {
return: {
bg: string;
text: string;
};
};
comment: string; comment: string;
constant: string; constant: string;
constantOtherReferenceLink: string; constantOtherReferenceLink: string;
entity: string; entity: string;
entityTag: string; entityTag: string;
invalid: { invalid: { illegal: { bg: string; text: string } };
illegal: {
bg: string;
text: string;
};
};
keyword: string; keyword: string;
markup: { markup: {
bold: string; bold: string;
changed: { changed: { bg: string; text: string };
bg: string; deleted: { bg: string; text: string };
text: string;
};
deleted: {
bg: string;
text: string;
};
heading: string; heading: string;
ignored: { ignored: { bg: string; text: string };
bg: string; inserted: { bg: string; text: string };
text: string;
};
inserted: {
bg: string;
text: string;
};
italic: string; italic: string;
list: string; list: string;
}; };

View File

@@ -39,9 +39,7 @@ export function createTheme(theme: Theme): void {
} }
createGlobalTheme(":root", themeVars, theme); createGlobalTheme(":root", themeVars, theme);
createGlobalTheme(":root", otherThemeVars, { createGlobalTheme(":root", otherThemeVars, {
border: { border: { radius: "6px" },
radius: "6px",
},
color: { color: {
git: "#f05133", git: "#f05133",
light: { light: {

View File

@@ -1,12 +1,4 @@
const num = { const num = { num1: null, num2: null, num3: null, num4: null, num5: null, num6: null, num7: null };
num1: null,
num2: null,
num3: null,
num4: null,
num5: null,
num6: null,
num7: null,
};
const alpha = { const alpha = {
num10: null, num10: null,
@@ -20,33 +12,12 @@ const alpha = {
num90: null, num90: null,
}; };
export const primary = { export const primary = { self: null, contrast: null, dark: num, light: num, alpha: alpha, hover: null, active: null };
self: null,
contrast: null,
dark: num,
light: num,
alpha: alpha,
hover: null,
active: null,
};
export const secondary = { export const secondary = {
self: null, self: null,
dark: { dark: { num8: null, num9: null, num10: null, num11: null, num12: null, num13: null, ...num },
num8: null, light: { num1: null, num2: null, num3: null, num4: null },
num9: null,
num10: null,
num11: null,
num12: null,
num13: null,
...num,
},
light: {
num1: null,
num2: null,
num3: null,
num4: null,
},
alpha: alpha, alpha: alpha,
button: null, button: null,
hover: null, hover: null,

View File

@@ -1,32 +1,8 @@
const msg = { const msg = { bg: null, border: null, text: null };
bg: null,
border: null,
text: null,
};
const error = { const error = { ...msg, bg: { self: null, active: null, hover: null } };
...msg, const success = { ...msg };
bg: { const warning = { ...msg };
self: null, const info = { ...msg };
active: null,
hover: null,
},
};
const success = { export const message = { error, success, warning, info };
...msg,
};
const warning = {
...msg,
};
const info = {
...msg,
};
export const message = {
error,
success,
warning,
info,
};

View File

@@ -1,11 +1,4 @@
const baseColor = { const baseColor = { self: null, light: null, dark: { num1: null, num2: null } };
self: null,
light: null,
dark: {
num1: null,
num2: null,
},
};
const commitColor = { const commitColor = {
/** 提交哈希值颜色 */ /** 提交哈希值颜色 */
@@ -23,26 +16,14 @@ const commitColor = {
export const named = { export const named = {
/** 红色/提交警告签名颜色 */ /** 红色/提交警告签名颜色 */
red: { red: { ...commitColor, ...baseColor },
...commitColor,
...baseColor,
},
/** 橙色/提交未匹配签名颜色 */ /** 橙色/提交未匹配签名颜色 */
orange: { orange: { ...commitColor, ...baseColor },
...commitColor,
...baseColor,
},
/** 黄色/提交未信任签名颜色 */ /** 黄色/提交未信任签名颜色 */
yellow: { yellow: { ...commitColor, ...baseColor },
...commitColor,
...baseColor,
},
olive: baseColor, olive: baseColor,
/** 绿色/提交信任签名颜色 */ /** 绿色/提交信任签名颜色 */
green: { green: { ...commitColor, ...baseColor },
...commitColor,
...baseColor,
},
teal: baseColor, teal: baseColor,
blue: baseColor, blue: baseColor,
violet: baseColor, violet: baseColor,
@@ -50,10 +31,7 @@ export const named = {
pink: baseColor, pink: baseColor,
brown: baseColor, brown: baseColor,
black: baseColor, black: baseColor,
grey: { grey: { self: null, light: null },
self: null,
light: null,
},
gold: null, gold: null,
white: null, white: null,
}; };

View File

@@ -8,9 +8,7 @@ function varMapper(prefix: string | null = null) {
path = path.map(item => item.replace(/^num/, "")); path = path.map(item => item.replace(/^num/, ""));
value = path.join("-"); value = path.join("-");
} }
if (prefix) { if (prefix) value = `${prefix}-${value}`;
value = `${prefix}-${value}`;
}
return value; return value;
}; };
} }
@@ -32,26 +30,13 @@ const vars = {
github: color.github, github: color.github,
}; };
const otherVars = { const otherVars = { border: { radius: null }, color: { ...color.otherAuto } };
border: {
radius: null,
},
color: {
...color.otherAuto,
},
};
const customVars = { const customVars = {
cloneMenuWidth: "clone-menu-width", cloneMenuWidth: "clone-menu-width",
explore: { explore: { repolistColumns: "explore-repolist-columns", userlistColumns: "explore-userlist-columns" },
repolistColumns: "explore-repolist-columns",
userlistColumns: "explore-userlist-columns",
},
userRepolistColumns: "user-repolist-columns", userRepolistColumns: "user-repolist-columns",
org: { org: { repolistColumns: "org-repolist-columns", userlistColumns: "org-userlist-columns" },
repolistColumns: "org-repolist-columns",
userlistColumns: "org-userlist-columns",
},
}; };
export const themeVars = createGlobalThemeContract(vars, varMapper()); export const themeVars = createGlobalThemeContract(vars, varMapper());

View File

@@ -221,6 +221,7 @@ export const actionViewRight = css`
padding: 8px 10px; padding: 8px 10px;
&.selected { &.selected {
// 滚动时固定在顶部的高度与 job-info-header 高度相同
top: 80px; top: 80px;
} }