Compare commits

..

3 Commits

Author SHA1 Message Date
lutinglt
065d7893d8 亮色主题适配 2025-08-07 18:26:21 +08:00
lutinglt
0a6770c28e 亮色主题 2025-08-07 16:19:18 +08:00
lutinglt
0825efeb2c update readme 2025-08-06 15:23:48 +08:00
13 changed files with 112 additions and 42 deletions

17
.github/release.md vendored
View File

@@ -1,20 +1,11 @@
## ✨ Feature ## ✨ Feature
#### CSS 变量 - 支持亮色主题
- 支持自定义探索/组织/用户页面的仓库列表列数 ## 🎈 Perf
- 支持自定义探索/组织页面的用户/组织列表列数
## 🌈 Style - 优化差异对比的代码折叠/展开按钮的高度和动画效果
#### 更符合 GitHub 风格
- 同步 Issue/PR 的评论样式
- 同步表情菜单样式
- 同步探索/组织/用户页面的仓库列表样式
- 同步探索/组织页面的用户列表样式
- 同步探索页面的组织列表样式
## 🐞 Fix ## 🐞 Fix
- 修复探索页面下仓库的类型标签意外触发悬浮效果 - 修复仓库页面与探索页面下仓库主题标签字重不一致的问题

1
.gitignore vendored
View File

@@ -2,3 +2,4 @@ dist
node_modules node_modules
package-lock.json package-lock.json
.env .env
.VSCodeCounter

View File

@@ -56,9 +56,9 @@ THEMES = gitea-dark, github-dark
| --custom-clone-menu-width | 克隆菜单宽度 | Gitea | 332px | 200px | 150px | 400px | | --custom-clone-menu-width | 克隆菜单宽度 | Gitea | 332px | 200px | 150px | 400px |
| --custom-explore-repolist-columns | 探索页面的仓库列表列数 | 2 | 2 | 2 | | | | --custom-explore-repolist-columns | 探索页面的仓库列表列数 | 2 | 2 | 2 | | |
| --custom-explore-userlist-columns | 探索页面的用户/组织列表列数 | 3 | 1 | 2/3 | | | | --custom-explore-userlist-columns | 探索页面的用户/组织列表列数 | 3 | 1 | 2/3 | | |
| --custom-user-repolist-columns | 用户页面的仓库列表列数 | 2 | 2 | 2 | | | | --custom-user-repolist-columns | 用户页面的仓库列表列数 | 2 | 2 | 1/2 | | |
| --custom-org-repolist-columns | 组织页面的仓库列表列数 | 1 | 1 | 1 | | | | --custom-org-repolist-columns | 组织页面的仓库列表列数 | 1 | 1 | 1/2 | | |
| --custom-org-userlist-columns | 组织页面的用户列表列数 | 2 | 1 | 2 | | | | --custom-org-userlist-columns | 组织页面的用户列表列数 | 2 | 1 | 1/2 | | |
## 截图 ## 截图

View File

@@ -6,7 +6,6 @@
- defineTheme 颜色生成代码重构 - defineTheme 颜色生成代码重构
- 亮色主题适配/测试 - 亮色主题适配/测试
- 自动颜色主题生成 - 自动颜色主题生成
- github primer 官方库集成
### 其他 ### 其他

View File

@@ -1,4 +1,6 @@
import { saturate } from "polished";
import type { Console, Diff, Other } from "src"; import type { Console, Diff, Other } from "src";
import { scaleColorLight } from "src/functions";
import type { Github } from "src/types"; import type { Github } from "src/types";
import { themeVars } from "src/types/vars"; import { themeVars } from "src/types/vars";
import { defineTheme } from "./color"; import { defineTheme } from "./color";
@@ -81,11 +83,9 @@ export type GithubColor = {
button: { button: {
primary: { primary: {
fgColor: { fgColor: {
accent: string;
rest: string; rest: string;
}; };
bgColor: { bgColor: {
rest: string;
hover: string; hover: string;
}; };
}; };
@@ -114,7 +114,9 @@ export type GithubColor = {
}; };
}; };
shadow: { shadow: {
floating: string; floating: {
small: string;
};
}; };
overlay: { overlay: {
backdrop: { backdrop: {
@@ -134,7 +136,6 @@ export type GithubColor = {
num2: string; num2: string;
num3: string; num3: string;
num4: string; num4: string;
num5: string;
}; };
borderColor: { borderColor: {
num0: string; num0: string;
@@ -244,7 +245,7 @@ export function defineGithubTheme(githubColor: GithubColor): Theme {
button: githubColor.control.bgColor.rest, button: githubColor.control.bgColor.rest,
codeBg: "unset", codeBg: "unset",
shadow: { shadow: {
self: githubColor.shadow.floating, self: githubColor.shadow.floating.small,
opaque: themeVars.color.shadow.self, opaque: themeVars.color.shadow.self,
}, },
secondaryBg: "unset", secondaryBg: "unset",
@@ -323,11 +324,11 @@ export function defineGithubTheme(githubColor: GithubColor): Theme {
}, },
primary: { primary: {
fgColor: { fgColor: {
accent: githubColor.button.primary.fgColor.accent, accent: saturate(0.1, scaleColorLight(githubColor.fgColor.success, githubColor.isDarkTheme ? 10 : -10)),
rest: githubColor.button.primary.fgColor.rest, rest: githubColor.button.primary.fgColor.rest,
}, },
bgColor: { bgColor: {
rest: githubColor.button.primary.bgColor.rest, rest: themeVars.github.bgColor.success.emphasis,
hover: githubColor.button.primary.bgColor.hover, hover: githubColor.button.primary.bgColor.hover,
}, },
borderColor: { borderColor: {
@@ -377,7 +378,10 @@ export function defineGithubTheme(githubColor: GithubColor): Theme {
num2: githubColor.contribution.default.bgColor.num2, num2: githubColor.contribution.default.bgColor.num2,
num3: githubColor.contribution.default.bgColor.num3, num3: githubColor.contribution.default.bgColor.num3,
num4: githubColor.contribution.default.bgColor.num4, num4: githubColor.contribution.default.bgColor.num4,
num5: githubColor.contribution.default.bgColor.num5, num5: saturate(
0.2,
scaleColorLight(githubColor.contribution.default.bgColor.num4, githubColor.isDarkTheme ? 58 : -58)
),
}, },
borderColor: { borderColor: {
num0: githubColor.contribution.default.borderColor.num0, num0: githubColor.contribution.default.borderColor.num0,

View File

@@ -29,11 +29,11 @@ export const diff = css`
} }
/* 展开/收缩按钮 */ /* 展开/收缩按钮 */
.code-expander-button { .code-expander-button {
height: 24px !important; height: 28px !important;
line-height: 24px;
&:hover { &:hover {
background: ${themeVars.github.bgColor.accent.emphasis}; background: ${themeVars.github.bgColor.accent.emphasis};
color: ${themeVars.color.white}
} }
} }
/* 行号居中 */ /* 行号居中 */

View File

@@ -42,19 +42,19 @@ export const babel = css`
border-radius: 25px !important; border-radius: 25px !important;
&.green { &.green {
color: ${themeVars.color.text.self} !important; color: ${themeVars.color.white} !important;
background-color: ${themeVars.github.bgColor.success.emphasis} !important; background-color: ${themeVars.github.bgColor.success.emphasis} !important;
border-color: ${themeVars.github.bgColor.success.emphasis} !important; border-color: ${themeVars.github.bgColor.success.emphasis} !important;
} }
&.red { &.red {
color: ${themeVars.color.text.self} !important; color: ${themeVars.color.white} !important;
background-color: ${themeVars.github.bgColor.done.emphasis} !important; background-color: ${themeVars.github.bgColor.done.emphasis} !important;
border-color: ${themeVars.github.bgColor.done.emphasis} !important; border-color: ${themeVars.github.bgColor.done.emphasis} !important;
} }
&.purple { &.purple {
color: ${themeVars.color.text.self} !important; color: ${themeVars.color.white} !important;
background-color: ${themeVars.github.bgColor.done.emphasis} !important; background-color: ${themeVars.github.bgColor.done.emphasis} !important;
border-color: ${themeVars.github.bgColor.done.emphasis} !important; border-color: ${themeVars.github.bgColor.done.emphasis} !important;
} }

View File

@@ -80,12 +80,13 @@ export const repoTopic = css`
#repo-topics .ui.label.repo-topic { #repo-topics .ui.label.repo-topic {
border-radius: 25px; border-radius: 25px;
font-size: 12px; font-size: 12px;
font-weight: 500;
padding: 5px 10px; padding: 5px 10px;
background-color: ${themeVars.github.bgColor.accent.muted}; background-color: ${themeVars.github.bgColor.accent.muted};
color: ${themeVars.github.fgColor.accent}; color: ${themeVars.github.fgColor.accent};
&:hover { &:hover {
background-color: ${themeVars.github.bgColor.accent.emphasis}; background-color: ${themeVars.github.bgColor.accent.emphasis};
color: ${themeVars.color.text.self}; color: ${themeVars.color.white};
} }
} }
`; `;

View File

@@ -68,7 +68,7 @@ export const navbarRight = css`
.navbar-profile-admin { .navbar-profile-admin {
background-color: ${themeVars.github.bgColor.accent.emphasis}; background-color: ${themeVars.github.bgColor.accent.emphasis};
border-radius: 25px; border-radius: 25px;
color: ${themeVars.color.text.self}; color: ${themeVars.color.white};
font-size: 8px; font-size: 8px;
font-weight: 600; font-weight: 600;
padding: 2px 5px; padding: 2px 5px;

View File

@@ -9,6 +9,8 @@ export const transition = css`
.job-step-logs, .job-step-logs,
.job-brief-item, .job-brief-item,
.repo-file-cell, .repo-file-cell,
// 差异对比的代码折叠按钮
.code-expander-button,
.tippy-box .flex-items-block .item, .tippy-box .flex-items-block .item,
.clone-panel-tab .item, .clone-panel-tab .item,
.ui.form select, .ui.form select,

View File

@@ -1,6 +1,6 @@
import { defineGithubTheme, type GithubColor } from "src/core/github"; import { defineGithubTheme } from "src/core/github";
const github: GithubColor = { export default defineGithubTheme({
isDarkTheme: true, isDarkTheme: true,
display: { display: {
brown: { fgColor: "#b69a6d" }, brown: { fgColor: "#b69a6d" },
@@ -53,22 +53,20 @@ const github: GithubColor = {
translucent: "#ffffff26", translucent: "#ffffff26",
}, },
button: { button: {
primary: { fgColor: { accent: "#39d353", rest: "#ffffff" }, bgColor: { rest: "#238636", hover: "#29903b" } }, primary: { fgColor: { rest: "#ffffff" }, bgColor: { hover: "#29903b" } },
danger: { fgColor: { rest: "#fa5e55", hover: "#ffffff" }, bgColor: { hover: "#b62324" } }, danger: { fgColor: { rest: "#fa5e55", hover: "#ffffff" }, bgColor: { hover: "#b62324" } },
}, },
control: { control: {
bgColor: { active: "#2a313c", hover: "#262c36", rest: "#212830" }, bgColor: { active: "#2a313c", hover: "#262c36", rest: "#212830" },
transparent: { bgColor: { active: "#656c7640", hover: "#656c7633", selected: "#656c761a" } }, transparent: { bgColor: { active: "#656c7640", hover: "#656c7633", selected: "#656c761a" } },
}, },
shadow: { floating: "#01040966" }, shadow: { floating: { small: "#01040966" } },
overlay: { backdrop: { bgColor: "#21283066" } }, overlay: { backdrop: { bgColor: "#21283066" } },
underlineNav: { borderColor: { active: "#f78166" } }, underlineNav: { borderColor: { active: "#f78166" } },
contribution: { contribution: {
default: { default: {
bgColor: { num0: "#151b23", num1: "#033a16", num2: "#196c2e", num3: "#2ea043", num4: "#56d364", num5: "#7ee787" }, bgColor: { num0: "#151b23", num1: "#033a16", num2: "#196c2e", num3: "#2ea043", num4: "#56d364" },
borderColor: { num0: "#0104090d" }, borderColor: { num0: "#0104090d" },
}, },
}, },
}; });
export default defineGithubTheme(github);

74
themes/light.css.ts Normal file
View File

@@ -0,0 +1,74 @@
import { defineGithubTheme } from "src/core/github";
// [TODO] chroma 语法高亮的颜色
export default defineGithubTheme({
isDarkTheme: false,
display: {
brown: { fgColor: "#755f43" },
cyan: { fgColor: "#006a80" },
indigo: { fgColor: "#494edf" },
lemon: { fgColor: "#786002" },
olive: { fgColor: "#56682c" },
teal: { fgColor: "#106e75" },
},
diffBlob: {
addtionNum: { bgColor: "#aceebb" },
addtionWord: { bgColor: "#aceebb" },
deletionNum: { bgColor: "#ffcecb" },
deletionWord: { bgColor: "#ffcecb" },
hunkNum: { bgColor: { rest: "#b6e3ff" } },
},
fgColor: {
accent: "#0969da",
attention: "#9a6700",
danger: "#d1242f",
default: "#1f2328",
disabled: "#818b98",
done: "#8250df",
neutral: "#59636e",
severe: "#bc4c00",
sponsors: "#bf3989",
success: "#1a7f37",
black: "#1f2328",
white: "#ffffff",
muted: "#59636e",
},
bgColor: {
accent: { emphasis: "#0969da", muted: "#ddf4ff" },
attention: { muted: "#fff8c5" },
success: { emphasis: "#1f883d", muted: "#dafbe1" },
danger: { muted: "#ffebe9" },
done: { emphasis: "#8250df" },
default: "#ffffff",
inset: "#f6f8fa",
muted: "#f6f8fa",
neutral: { muted: "#818b981f" },
},
borderColor: {
accent: { emphasis: "#0969da" },
default: "#d1d9e0",
attention: { emphasis: "#9a6700" },
success: { emphasis: "#1a7f37" },
done: { emphasis: "#8250df" },
muted: "#d1d9e0b3",
translucent: "#1f232826",
},
button: {
primary: { fgColor: { rest: "#ffffff" }, bgColor: { hover: "#1c8139" } },
danger: { fgColor: { rest: "#d1242f", hover: "#ffffff" }, bgColor: { hover: "#cf222e" } },
},
control: {
bgColor: { active: "#e6eaef", hover: "#eff2f5", rest: "#f6f8fa" },
transparent: { bgColor: { active: "#818b9826", hover: "#818b981a", selected: "#818b9826" } },
},
shadow: { floating: { small: "#25292e0a" } },
overlay: { backdrop: { bgColor: "#c8d1da66" } },
underlineNav: { borderColor: { active: "#fd8c73" } },
contribution: {
default: {
bgColor: { num0: "#eff2f5", num1: "#aceebb", num2: "#4ac26b", num3: "#2da44e", num4: "#116329" },
borderColor: { num0: "#1f23280d" },
},
},
});

View File

@@ -34,7 +34,7 @@ export default defineConfig(({ mode }) => {
}, },
plugins: [ plugins: [
linaria({ linaria({
include: ["**/*.{ts,tsx}"], include: ["**/*.ts"],
babelOptions: { babelOptions: {
presets: ["@babel/preset-typescript"], presets: ["@babel/preset-typescript"],
}, },