github 与 gitea 全部颜色映射

This commit is contained in:
lutinglt
2025-07-01 21:59:07 +08:00
parent c76a8ba7b6
commit 0a353fd572
5 changed files with 81 additions and 37 deletions

13
.github/release.md vendored
View File

@@ -2,12 +2,17 @@
#### 更符合 GitHub 风格 #### 更符合 GitHub 风格
- 差异对比折叠行文本颜色同步 - 代码差异对比折叠行文本颜色同步
- 差异对比行号位置同步 - 代码差异对比行号位置同步
- 差异对比按钮和折叠行高度同步 - 代码差异对比按钮和折叠行高度同步
- Actions 日志页面标题颜色同步 - Actions 日志页面标题颜色同步
- Actions 日志页面设置菜单背景色同步 - Actions 日志页面设置菜单背景色同步
- 菜单背景色同步当前最新颜色 - 菜单背景色同步当前最新颜色
- Markdown 背景色同步
- 补充 Markdown 代码块背景色
- 弹窗阴影颜色同步
- 仓库项目页面列背景色同步
- Issue/PR 表情背景色同步
## 🎈 Perf ## 🎈 Perf
@@ -15,4 +20,4 @@
## 🐞 Fix ## 🐞 Fix
- 修复差异对比分列视图下颜色丢失 - 修复代码差异对比分列视图下颜色丢失

View File

@@ -7,11 +7,11 @@ import type { Theme } from "./theme";
interface ColorTheme { interface ColorTheme {
/** 用于标识当前是否为暗色主题: `true` 暗色 `false` 亮色 */ /** 用于标识当前是否为暗色主题: `true` 暗色 `false` 亮色 */
isDarkTheme: boolean; isDarkTheme: boolean;
/** 主色调 */ /** 主色调(强调色) */
primary: string; primary: string;
/** 主色调的对比色, 一般用于 `color` 属性, primary 用于 `background-color` */ /** 主色调的对比色, 一般用于 `color` 属性, primary 用于 `background-color` */
primaryContrast: string; primaryContrast: string;
/** 副色调 */ /** 副色调(边框色) */
secondary: string; secondary: string;
/** 红色 */ /** 红色 */
red: string; red: string;

View File

@@ -67,52 +67,83 @@ export const other = {
menu: null, menu: null,
/** 卡片背景色, 但是找不到元素, 可能是个人 README */ /** 卡片背景色, 但是找不到元素, 可能是个人 README */
card: null, card: null,
/** Markdown 颜色 */
markup: { markup: {
/** 隔行背景色 */
tableRow: "color-markup-table-row", tableRow: "color-markup-table-row",
code: { code: {
/** 代码块背景色 */
block: null, block: null,
/** 代码行背景色 */
inline: null, inline: null,
}, },
}, },
/** 普通按钮的背景色 (basic 非 primary) */
button: null, button: null,
/** 代码页面背景色 */
codeBg: "color-code-bg", codeBg: "color-code-bg",
/** 弹窗阴影 */
shadow: { shadow: {
self: null, self: null,
/** css 没有使用 */
opaque: null, opaque: null,
}, },
/** 弹窗按钮行的背景色 */
secondaryBg: "color-secondary-bg", secondaryBg: "color-secondary-bg",
/** 代码差异对比折叠行按钮背景色 */
expandButton: "color-expand-button", expandButton: "color-expand-button",
/** 不知道 */
placeholderText: "color-placeholder-text", placeholderText: "color-placeholder-text",
/** 不知道, css 没有 */
editorLineHighlight: "color-editor-line-highlight", editorLineHighlight: "color-editor-line-highlight",
/** 仓库项目页面列的背景色 */
projectColumnBg: "color-project-column-bg", projectColumnBg: "color-project-column-bg",
/** caret-color 属性 */
caret: null, caret: null,
/** Issue 表情按钮 */
reaction: { reaction: {
/** css 里没用 */
bg: null, bg: null,
/** 悬停时颜色 */
hoverBg: "color-reaction-hover-bg", hoverBg: "color-reaction-hover-bg",
/** 点击后颜色 */
activeBg: "color-reaction-active-bg", activeBg: "color-reaction-active-bg",
}, },
/** 不知道是干啥的 */
tooltip: { tooltip: {
text: null, text: null,
bg: null, bg: null,
}, },
/** 顶部导航栏(用户导航栏) */
nav: { nav: {
/** 背景色 */
bg: null, bg: null,
/** 悬停时背景色 */
hoverBg: "color-nav-hover-bg", hoverBg: "color-nav-hover-bg",
/** color 颜色 */
text: null, text: null,
}, },
/** 顶部二级导航栏背景色(仓库导航栏等) */
secondaryNavBg: "color-secondary-nav-bg", secondaryNavBg: "color-secondary-nav-bg",
/** 标签 */ /** 普通标签 */
label: { label: {
text: null, text: null,
bg: null, bg: null,
hoverBg: "color-label-hover-bg", hoverBg: "color-label-hover-bg",
/** css 没用 */
activeBg: "color-label-active-bg", activeBg: "color-label-active-bg",
}, },
/** 不知道. 似乎和最后一次 review 相关的边框色 */
accent: null, accent: null,
/** 不知道. 似乎和最后一次 review 相关的背景色 */
smallAccent: "color-small-accent", smallAccent: "color-small-accent",
/** 不知道啥玩意, 跟文件预览内容行颜色有关系 */
highlight: { highlight: {
bg: null, /** 在行号前追加的伪元素颜色 */
fg: null, fg: null,
/** 背景色 */
bg: null,
}, },
/** 不知道啥玩意 dimmer 的背景色 */
overlayBackdrop: "color-overlay-backdrop", overlayBackdrop: "color-overlay-backdrop",
}; };

View File

@@ -1,9 +1,9 @@
import type { MapLeafNodes } from "src/core/types"; import type { MapLeafNodes } from "src/core/types";
import * as color from "./color"; import * as color from "./color";
/** 主色调 */ /** 主色调(强调色) */
export type Primary = MapLeafNodes<typeof color.primary, string>; export type Primary = MapLeafNodes<typeof color.primary, string>;
/** 副色调 */ /** 副色调(边框色) */
export type Secondary = MapLeafNodes<typeof color.secondary, string>; export type Secondary = MapLeafNodes<typeof color.secondary, string>;
/** 基础颜色 */ /** 基础颜色 */
export type Named = MapLeafNodes<typeof color.named, string>; export type Named = MapLeafNodes<typeof color.named, string>;

View File

@@ -51,6 +51,9 @@ const github = {
default: "#0d1117", default: "#0d1117",
inset: "#010409", inset: "#010409",
muted: "#151b23", muted: "#151b23",
neutral: {
muted: "#656c7633",
}
}, },
borderColor: { borderColor: {
default: "#3d444d", default: "#3d444d",
@@ -60,14 +63,19 @@ const github = {
bgColor: { bgColor: {
active: "#2a313c", active: "#2a313c",
hover: "#262c36", hover: "#262c36",
rest: "#212830",
}, },
transparent: { transparent: {
bgColor: { bgColor: {
selected: "#656c761a", active: "#656c7640",
hover: "#656c7633", hover: "#656c7633",
selected: "#656c761a",
}, },
}, },
}, },
shadow: {
floating: "#01040966"
}
}; };
const console: Console = { const console: Console = {
@@ -160,62 +168,62 @@ const other: Other = {
opaque: themeVars.color.box.header, opaque: themeVars.color.box.header,
}, },
active: github.control.transparent.bgColor.selected, active: github.control.transparent.bgColor.selected,
menu: themeVars.color.body, // 此菜单项涉及太多, 不仅仅是下拉菜单, 默认使用 body 颜色 menu: github.bgColor.inset,
card: themeVars.color.body, card: themeVars.color.body,
markup: { markup: {
tableRow: "#ffffff06", tableRow: github.bgColor.muted,
code: { code: {
block: "#ffffff16", block: github.bgColor.muted,
inline: "#ffffff26", inline: github.bgColor.neutral.muted,
}, },
}, },
button: "#212830", button: github.control.bgColor.rest,
codeBg: "#0d1117", codeBg: "unset",
shadow: { shadow: {
self: "#00000060", self: github.shadow.floating,
opaque: "#00000080", opaque: themeVars.color.shadow.self,
}, },
secondaryBg: "#ffffff26", secondaryBg: "unset",
expandButton: github.diffBlob.hunkNum.bgColor.rest, expandButton: github.diffBlob.hunkNum.bgColor.rest,
placeholderText: "#8a8e99", placeholderText: themeVars.color.text.light.num3,
editorLineHighlight: themeVars.color.primary.light.num5, editorLineHighlight: themeVars.color.primary.light.num5,
projectColumnBg: themeVars.color.secondary.light.num2, projectColumnBg: github.bgColor.inset,
caret: themeVars.color.text.self, caret: themeVars.color.text.dark,
reaction: { reaction: {
bg: "#ffffff12", bg: "initial",
hoverBg: themeVars.color.primary.light.num4, hoverBg: github.bgColor.accent.muted,
activeBg: themeVars.color.primary.light.num5, activeBg: github.bgColor.accent.muted,
}, },
tooltip: { tooltip: {
text: "#fff", text: github.fgColor.default,
bg: "#000000f0", bg: github.bgColor.default,
}, },
nav: { nav: {
bg: github.bgColor.inset, bg: github.bgColor.inset,
hoverBg: themeVars.color.hover.self, hoverBg: github.control.transparent.bgColor.hover,
text: themeVars.color.text.self, text: themeVars.color.text.self,
}, },
secondaryNavBg: themeVars.color.nav.bg, secondaryNavBg: themeVars.color.nav.bg,
label: { label: {
text: "#fff", text: themeVars.color.text.self,
bg: "#7c84974b", bg: github.bgColor.neutral.muted,
hoverBg: "#7c8497a0", hoverBg: github.control.transparent.bgColor.active,
activeBg: "#7c8497", activeBg: themeVars.color.label.hoverBg,
}, },
accent: themeVars.color.primary.light.num1, accent: themeVars.color.primary.light.num1,
smallAccent: themeVars.color.primary.light.num5, smallAccent: themeVars.color.primary.light.num5,
highlight: { highlight: {
bg: "#87651e", fg: github.fgColor.attention,
fg: "#352c1c", bg: github.bgColor.attention.muted,
}, },
overlayBackdrop: "#080808c0", overlayBackdrop: themeVars.color.body,
}; };
export default defineTheme({ export default defineTheme({
isDarkTheme, isDarkTheme,
primary: github.fgColor.accent, primary: github.fgColor.accent,
primaryContrast: github.fgColor.default, primaryContrast: github.fgColor.default,
secondary: "#3d444d", secondary: github.borderColor.default,
red: github.fgColor.danger, red: github.fgColor.danger,
orange: github.fgColor.severe, orange: github.fgColor.severe,
yellow: github.fgColor.attention, yellow: github.fgColor.attention,