Compare commits
	
		
			23 Commits
		
	
	
		
			v1.24.4.25
			...
			c5c1ca4a6b
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | c5c1ca4a6b | ||
|   | 6bbc304a7c | ||
|   | 5c95add059 | ||
|   | 2efaeead6b | ||
|   | 29122e946c | ||
|   | 81be016be3 | ||
|   | 2ffdf501b3 | ||
|   | 9f2e5df49c | ||
|   | 00eda68f00 | ||
|   | fc4e6f43bb | ||
|   | 1f01495a10 | ||
|   | eae2961989 | ||
|   | 563c20f2cc | ||
|   | 058e1b89ee | ||
|   | c431fbadb4 | ||
|   | 74254a3f80 | ||
|   | 8118706706 | ||
|   | ffbfccd7dc | ||
|   | 1d8dfdb82b | ||
|   | 11422f3b05 | ||
|   | cca5e4e435 | ||
|   | 780c72919d | ||
|   | dc4eff2bd7 | 
| @@ -1,4 +1,8 @@ | |||||||
|  | # 开发模式下编译的主题 (开发模式仅编译单个主题) | ||||||
| DEV_THEME=dark | DEV_THEME=dark | ||||||
|  | # 把编译后的主题上传到服务器的服务器名称, 通过 SCP 上传 | ||||||
| SSH_SERVER=localhost | SSH_SERVER=localhost | ||||||
|  | # 上传到服务器的用户名称, 不支持密码, 请确保有 SSH 免密登录权限 | ||||||
| SSH_USER=root | SSH_USER=root | ||||||
|  | # 上传到服务器的主题路径, 请使用绝对路径 | ||||||
| GITEA_THEME_PATH=/data/gitea/public/assets/css/ | GITEA_THEME_PATH=/data/gitea/public/assets/css/ | ||||||
							
								
								
									
										15
									
								
								.github/release.md
									
									
									
									
										vendored
									
									
								
							
							
						
						| @@ -1,21 +1,18 @@ | |||||||
| ## ✨ Feature | ## ✨ Feature | ||||||
|  |  | ||||||
| - 支持自动颜色主题 (跟随系统) |  | ||||||
| - 支持亮色主题 |  | ||||||
| - 支持柔和的暗色主题 (dark-dimmed) |  | ||||||
|  |  | ||||||
| ## 🌈 Style | ## 🌈 Style | ||||||
|  |  | ||||||
| #### 更符合 GitHub 风格 | #### 更符合 GitHub 风格 | ||||||
|  |  | ||||||
| - 同步查看文件内容时的代码高亮色 (由于词法分析器的差异和解析问题, 只能实现大概相似, 目前观察到在 TypeScript 下词法分析器表现非常糟糕) | - 同步仓库代码文件页 README 导航栏样式 | ||||||
|  | - 同步分页菜单样式 | ||||||
|  |  | ||||||
| ## 🎈 Perf | ## 🎈 Perf | ||||||
|  |  | ||||||
| - 优化差异对比的代码折叠/展开按钮的高度和动画效果 | - 略微增加仓库代码文件列表的单行高度与 GitHub 一致 | ||||||
|  |  | ||||||
| ## 🐞 Fix | ## 🐞 Fix | ||||||
|  |  | ||||||
| - 修复仓库页面与探索页面下仓库主题标签字重不一致的问题 | - 修复 Action 作业步骤页面标题选中时滚动固定的高度问题 | ||||||
| - 修复发布页面下的分支按钮点击时高度变化问题 | - 修复用户公开活动页动态布局问题 | ||||||
| - 修复首页/登录页/注册页下导航栏右侧按钮样式问题 #10 | - 修复顶部导航栏工单管理/请求合并页面搜索框旁的选择下拉框按钮内容过窄 | ||||||
|   | |||||||
							
								
								
									
										160
									
								
								CONTRIBUTING.md
									
									
									
									
									
								
							
							
						
						| @@ -1,7 +1,159 @@ | |||||||
|  | # 贡献指南 | ||||||
|  |  | ||||||
|  | ## 目录结构 | ||||||
|  |  | ||||||
| | 目录              | 说明                         | | | 目录              | 说明                         | | ||||||
| | ----------------- | ---------------------------- | | | ----------------- | ---------------------------- | | ||||||
| | styles            | 元素 GitHub 风格             | | | src               | 主题生成框架与辅助工具的包   | | ||||||
| | styles/components | 具体页面的元素单独风格       | | | src/core          | 主题生成框架                 | | ||||||
| | styles/public     | 适用大部分页面的元素默认风格 | | | src/functions     | 主题辅助工具                 | | ||||||
|  | | src/types         | 主题的颜色变量定义           | | ||||||
|  | | styles            | 主题样式                     | | ||||||
|  | | styles/components | 具体页面的元素的样式         | | ||||||
|  | | styles/public     | 基础元素或跨页面的元素的样式 | | ||||||
| | themes            | 颜色主题                     | | | themes            | 颜色主题                     | | ||||||
| | themes/\<theme>   | 具体颜色主题自己的颜色或风格 | |  | ||||||
|  | ## 贡献说明 | ||||||
|  |  | ||||||
|  | 不推荐主题样式贡献, 因为 Gitea 主题最终是由单个 CSS 文件提供, 所以会有先后顺序覆盖, 样式影响广泛等问题. | ||||||
|  |  | ||||||
|  | 开发者每个人的思路不一样, 审核很难看出这些问题, 会极大增加维护难度. | ||||||
|  |  | ||||||
|  | 如果确定理解了 Gitea 的样式布局和我的思路, 请先提交 Issue 确认工作量和预期效果, 然后再开发提交 PR. | ||||||
|  |  | ||||||
|  | 如果认为有更好的思路, 欢迎提交 Issue. | ||||||
|  |  | ||||||
|  | > [!IMPORTANT] | ||||||
|  | > | ||||||
|  | > 提交 PR 时, 请执行 `npm run commit` | ||||||
|  |  | ||||||
|  | ## 开发环境 | ||||||
|  |  | ||||||
|  | 主题仅依赖于 Node.js 环境, 请确保你的环境中已经安装了 Node.js, 推荐使用 Node.js 20 或以上版本. | ||||||
|  |  | ||||||
|  | 请使用 VSCode 开发, 并安装仓库中推荐的插件. | ||||||
|  |  | ||||||
|  | 如果不喜欢多余的插件, 请务必安装 `vscode-styled-components` 插件, 此插件用于渲染和检查 TypeScript 中的 CSS 模板字符串. | ||||||
|  |  | ||||||
|  | 推荐使用 VSCode 1.102.0 版本以上开发, 此版本以上提供 TypeScript 代码中 16 进制颜色的支持. | ||||||
|  |  | ||||||
|  | ## 开发流程 | ||||||
|  |  | ||||||
|  | ### 安装依赖 | ||||||
|  |  | ||||||
|  | ```bash | ||||||
|  | npm install | ||||||
|  | ``` | ||||||
|  |  | ||||||
|  | ### 设置环境变量 | ||||||
|  |  | ||||||
|  | 在项目根目录下创建 `.env` 文件, 变量参考 `.env.example` 文件. | ||||||
|  |  | ||||||
|  | 环境变量用于发送编译后的主题到服务器上, 快速预览主题. | ||||||
|  |  | ||||||
|  | ### 编译主题 | ||||||
|  |  | ||||||
|  | 编译开发中的主题 | ||||||
|  |  | ||||||
|  | ```bash | ||||||
|  | npm run dev | ||||||
|  | ``` | ||||||
|  |  | ||||||
|  | 编译所有主题 | ||||||
|  |  | ||||||
|  | ```bash | ||||||
|  | npm run build | ||||||
|  | ``` | ||||||
|  |  | ||||||
|  | 格式化项目中的代码 | ||||||
|  |  | ||||||
|  | ```bash | ||||||
|  | npm run format | ||||||
|  | ``` | ||||||
|  |  | ||||||
|  | 用于 PR, 检查并编译项目中的所有代码并进行格式化 | ||||||
|  |  | ||||||
|  | ```bash | ||||||
|  | npm run commit | ||||||
|  | ``` | ||||||
|  |  | ||||||
|  | ## 开发规范 | ||||||
|  |  | ||||||
|  | `src`, `styles`, `themes` 为项目的主目录, 主目录下的第一个目录为模块. | ||||||
|  |  | ||||||
|  | 主目录或主目录下模块互相引用时, 请使用绝对路径, 例如 `import { defineTheme } from "src"` | ||||||
|  |  | ||||||
|  | 模块下的文件互相引用时, 请使用相对路径, 例如 `import { defineTheme } from "./theme"` | ||||||
|  |  | ||||||
|  | ## 颜色主题贡献 | ||||||
|  |  | ||||||
|  | 颜色主题名称格式: `主题名称-dark.css.ts` 或 `主题名称-light.css.ts`, 分别表示深色和亮色主题. | ||||||
|  |  | ||||||
|  | 如果主题有深色和亮色模式, 会自动生成自动颜色主题, 不需要手动添加. | ||||||
|  |  | ||||||
|  | 项目接受自定义主题并会附加到发布的版本中, 但项目所有者不参与维护和审核. | ||||||
|  |  | ||||||
|  | 请在颜色主题文件头部附加自己的作者信息, 方便 Issue 提问者找到你 `@`. | ||||||
|  |  | ||||||
|  | 推荐使用 `import { defineTheme } from "src"` 导入主题生成框架, 然后使用 `defineTheme` 函数生成主题, | ||||||
|  | defineTheme 中设置了一些经过计算得到的 Gitea 变量可以减少工作量, 具体请查看函数说明. | ||||||
|  |  | ||||||
|  | 颜色计算函数可以从 `src/functions` 导入, 例如 `import { scaleColorLight } from "src/functions"`, 或者使用 `polished` 库. | ||||||
|  |  | ||||||
|  | 例: `themes/主题名称-dark.css.ts` | ||||||
|  |  | ||||||
|  | ```ts | ||||||
|  | /** | ||||||
|  |  * @author 你的名字 | ||||||
|  |  * @description 主题描述 | ||||||
|  |  */ | ||||||
|  | import { defineTheme } from "src"; | ||||||
|  | export default defineTheme({ | ||||||
|  |   ... | ||||||
|  | }); | ||||||
|  | // 使用其他主题颜色作为基础 | ||||||
|  | import dark from "themes/dark"; | ||||||
|  | export default defineTheme({ | ||||||
|  |   ...dark, | ||||||
|  |   ... | ||||||
|  | }); | ||||||
|  | ``` | ||||||
|  |  | ||||||
|  | 如果不需要自定义代码高亮色, 则不传递 chroma 参数, 框架会自动根据主题的暗色或亮色生成代码高亮色. | ||||||
|  |  | ||||||
|  | 如果需要完全自定义每个 Gitea 变量, 请导入 `import type { Theme } from "src"` | ||||||
|  |  | ||||||
|  | 例: `themes/主题名称-dark.css.ts` | ||||||
|  |  | ||||||
|  | ```ts | ||||||
|  | /** | ||||||
|  |  * @author 你的名字 | ||||||
|  |  * @description 主题描述 | ||||||
|  |  */ | ||||||
|  | import type { Theme } from "src"; | ||||||
|  | export default theme: Theme = { | ||||||
|  |  ... | ||||||
|  | }; | ||||||
|  | ``` | ||||||
|  |  | ||||||
|  | 完成主题颜色开发后, 请在某个仓库的代码文件列表页, 打开 Code 菜单选择 Tea Cli 进行截图, 并放入 `screenshots` | ||||||
|  | 目录下, 截图名与主题名相同. (推荐克隆 Github 的 actions/checkout 仓库, 该仓库信息较全, 避免泄露个人隐私) | ||||||
|  |  | ||||||
|  | 然后将截图信息添加到 `README.md` 文件中, 可以在折叠部分中添加自己的说明. | ||||||
|  |  | ||||||
|  | ## 主题样式贡献 | ||||||
|  |  | ||||||
|  | 主题样式使用 TypeScript 的 css 模板字符串开发, 该模板字符串会经过 sass 预处理器处理, 支持 SCSS 语法并且主题只接受 SCSS 嵌套语法, 请不要使用 CSS 语法, 如果一定要用请说明原因. | ||||||
|  |  | ||||||
|  | 请尽量不要使用 SCSS 的函数, `vscode-styled-components` 插件会报错, 请使用 TypeScript 相关库处理, 比如主题自带的 | ||||||
|  | `polished` 库. | ||||||
|  |  | ||||||
|  | 推荐需要使用复杂处理时, 提取逻辑到 `src/functions` 目录下的函数中, 然后在 `src/styles` 目录下的样式文件中使用. | ||||||
|  |  | ||||||
|  | 主题样式中使用到的所有颜色必须使用颜色变量, 颜色变量导入 `import { themeVars } from "src/types/vars"` | ||||||
|  |  | ||||||
|  | 涉及到主题自己的颜色变量 `${themeVars.github.xxx}`, 在使用时请将使用的文件和变量添加到对应变量的注释中 | ||||||
|  | `src/types/color/github` | ||||||
|  |  | ||||||
|  | 小型圆角(6px)请使用全局圆角变量, 圆角变量导入 `import { otherThemeVars } from "src/types/vars"` | ||||||
|  | `${otherThemeVars.border.radius}` | ||||||
|   | |||||||
							
								
								
									
										82
									
								
								README.md
									
									
									
									
									
								
							
							
						
						| @@ -1,13 +1,23 @@ | |||||||
| # gitea-github-theme | # gitea-github-theme | ||||||
|  |  | ||||||
| 尽量保持与 GitHub 相同样式的 Gitea 主题 | 一个精致模仿 Github 风格的 Gitea 主题 | ||||||
|  |  | ||||||
| ### 主题说明 | > [!TIP] | ||||||
|  | > | ||||||
|  | > 推荐搭配文件图标浏览器插件一起使用更佳 | ||||||
|  | > [web-file-explorer-icons](https://github.com/catppuccin/web-file-explorer-icons) | ||||||
|  |  | ||||||
| 添加了短暂的过渡动画优化体验(与 GitHub Code 克隆列表动画一致) | ## 版本号说明 | ||||||
|  |  | ||||||
| 推荐搭配文件图标浏览器插件一起使用更佳 | 主题版本号格式: `Gitea 版本号.时间戳` | ||||||
| [github-file-explorer-icons](https://github.com/catppuccin/github-file-explorer-icons) |  | ||||||
|  | Gitea 版本号格式: `1.大版本号.小版本号` | ||||||
|  |  | ||||||
|  | Gitea 理论上小版本号变更不会修改前端布局, 所以主题的小版本号适用于所有 Gitea 大版本号相同的 Gitea 版本. | ||||||
|  |  | ||||||
|  | 比如: 主题版本 `1.24.4` 适用于 Gitea 版本 `>=1.24.0` ~ `<1.25.0` | ||||||
|  |  | ||||||
|  | 仅维护项目发布中的最新的 Gitea 版本, 其他旧版本主题不接受 Issue 和 PR. | ||||||
|  |  | ||||||
| ## 安装 | ## 安装 | ||||||
|  |  | ||||||
| @@ -15,7 +25,10 @@ | |||||||
| 2. 修改 `gitea/conf/app.ini`,并将 CSS 文件名去掉 `theme-` 的名称附加到 `[ui]` 下的 `THEMES` 末尾 | 2. 修改 `gitea/conf/app.ini`,并将 CSS 文件名去掉 `theme-` 的名称附加到 `[ui]` 下的 `THEMES` 末尾 | ||||||
| 3. 重启 Gitea | 3. 重启 Gitea | ||||||
| 4. 在设置中查看主题 | 4. 在设置中查看主题 | ||||||
| 5. 自动颜色主题需要亮色和暗色的主题文件 |  | ||||||
|  | > [!IMPORTANT] | ||||||
|  | > | ||||||
|  | > 自动颜色主题需要亮色和暗色的主题文件 | ||||||
|  |  | ||||||
| 例: 主题文件名为 `theme-github-dark.css`,则添加 `github-dark` 到 `THEMES` 末尾 | 例: 主题文件名为 `theme-github-dark.css`,则添加 `github-dark` 到 `THEMES` 末尾 | ||||||
|  |  | ||||||
| @@ -29,6 +42,23 @@ THEMES = gitea-auto, gitea-light, gitea-dark, github-auto, github-light, github- | |||||||
| 详细请查看 Gitea 文档 | 详细请查看 Gitea 文档 | ||||||
| [Gitea docs](https://docs.gitea.com/next/administration/customizing-gitea#customizing-the-look-of-gitea) | [Gitea docs](https://docs.gitea.com/next/administration/customizing-gitea#customizing-the-look-of-gitea) | ||||||
|  |  | ||||||
|  | ## 截图 | ||||||
|  |  | ||||||
|  | <details open> | ||||||
|  | <summary>GitHub</summary> | ||||||
|  | <h4>theme-github-light.css</h4> | ||||||
|  | <img src="screenshots/light.png"/> | ||||||
|  | <h4>theme-github-dark.css</h4> | ||||||
|  | <img src="screenshots/dark.png"/> | ||||||
|  | <h4>theme-github-soft-dark.css</h4> | ||||||
|  | <img src="screenshots/soft-dark.png"/> | ||||||
|  | </details> | ||||||
|  |  | ||||||
|  | <details> | ||||||
|  | <summary>其他主题</summary> | ||||||
|  | 等待贡献者ing... | ||||||
|  | </details> | ||||||
|  |  | ||||||
| ## 自定义 CSS 变量 | ## 自定义 CSS 变量 | ||||||
|  |  | ||||||
| 可以根据自己的偏好自定义主题的一部分样式 | 可以根据自己的偏好自定义主题的一部分样式 | ||||||
| @@ -54,31 +84,31 @@ THEMES = gitea-auto, gitea-light, gitea-dark, github-auto, github-light, github- | |||||||
|  |  | ||||||
| ### CSS 变量 | ### CSS 变量 | ||||||
|  |  | ||||||
| | 变量名                            | 描述                        | 默认值 | Github | 推荐  | 最小值 | 最大值 | | | 变量名                            | 描述                        | 默认  | Github | 推荐  | 最小  | 最大  | | ||||||
| | :-------------------------------- | :-------------------------- | :----- | :----- | :---- | :----- | :----- | | | :-------------------------------- | :-------------------------- | :---- | :----- | :---- | :---- | :---- | | ||||||
| | --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      | 1/2   |        |        | | | --custom-user-repolist-columns    | 用户页面的仓库列表列数      | 2     | 2      | 1/2   |       |       | | ||||||
| | --custom-org-repolist-columns     | 组织页面的仓库列表列数      | 1      | 1      | 1/2   |        |        | | | --custom-org-repolist-columns     | 组织页面的仓库列表列数      | 1     | 1      | 1/2   |       |       | | ||||||
| | --custom-org-userlist-columns     | 组织页面的用户列表列数      | 2      | 1      | 1/2   |        |        | | | --custom-org-userlist-columns     | 组织页面的用户列表列数      | 2     | 1      | 1/2   |       |       | | ||||||
|  |  | ||||||
| ## 截图 | ## 使用开发中的主题 | ||||||
|  |  | ||||||
|  | 也许你会想使用开发中的主题, 而不是发布的主题 | ||||||
|  |  | ||||||
|  | 请确保你已经安装了 Node.js 环境, 推荐使用 Node.js 20 或以上版本 | ||||||
|  |  | ||||||
|  | ```bash | ||||||
|  | git clone https://github.com/lutinglt/gitea-github-theme.git | ||||||
|  | cd gitea-github-theme | ||||||
|  | npm install | ||||||
|  | npm run build | ||||||
|  | ``` | ||||||
|  |  | ||||||
|  | 编译完成后, 会在 `dist` 目录下生成主题文件, 你可以将主题文件放入 `gitea/public/assets/css` 目录下, 然后在 | ||||||
|  | `gitea/conf/app.ini` 中添加主题名称到 `THEMES` 末尾 | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| ## 贡献 | ## 贡献 | ||||||
|  |  | ||||||
| 欢迎提交 Issue 或 Pull Request | 请查看 [CONTRIBUTING](CONTRIBUTING.md) | ||||||
|   | |||||||
							
								
								
									
										15
									
								
								TODO.md
									
									
									
									
									
								
							
							
						
						| @@ -1,11 +1,10 @@ | |||||||
| ### 重大 | ### 重大 | ||||||
|  |  | ||||||
| - gitea issue 默认标签颜色匹配使用 github 样式 | - gitea issue 暗色模式下默认标签颜色匹配使用 github 样式 | ||||||
| - issue/PR 列表样式 github 布局 | - issue/PR 列表样式 github 布局 | ||||||
| - styles/themes 库组件导出整理 | - 用户动态仪表板样式优化 | ||||||
| - defineTheme 颜色生成代码重构 | - 色盲主题支持 | ||||||
|  | - 打开文件时的文件导航树样式和滚动高度 | ||||||
| ### 其他 | - 私有库标签大小, 组织页面下的RSS订阅按钮样式 | ||||||
|  | - 登录/注册页面样式 | ||||||
| - README 更新/截图更新 | - 创建仓库页面样式 ? (待验证) | ||||||
| - CONTRIBUTING 更新 |  | ||||||
|   | |||||||
							
								
								
									
										
											BIN
										
									
								
								screenshots/action.png
									
									
									
									
										vendored
									
									
								
							
							
						
						| Before Width: | Height: | Size: 109 KiB | 
							
								
								
									
										
											BIN
										
									
								
								screenshots/actions.png
									
									
									
									
										vendored
									
									
								
							
							
						
						| Before Width: | Height: | Size: 176 KiB | 
							
								
								
									
										
											BIN
										
									
								
								screenshots/commit.png
									
									
									
									
										vendored
									
									
								
							
							
						
						| Before Width: | Height: | Size: 394 KiB | 
							
								
								
									
										
											BIN
										
									
								
								screenshots/dark.png
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 202 KiB | 
							
								
								
									
										
											BIN
										
									
								
								screenshots/dispatch.png
									
									
									
									
										vendored
									
									
								
							
							
						
						| Before Width: | Height: | Size: 111 KiB | 
							
								
								
									
										
											BIN
										
									
								
								screenshots/file_list.png
									
									
									
									
										vendored
									
									
								
							
							
						
						| Before Width: | Height: | Size: 343 KiB | 
							
								
								
									
										
											BIN
										
									
								
								screenshots/light.png
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 201 KiB | 
							
								
								
									
										
											BIN
										
									
								
								screenshots/release.png
									
									
									
									
										vendored
									
									
								
							
							
						
						| Before Width: | Height: | Size: 187 KiB | 
							
								
								
									
										
											BIN
										
									
								
								screenshots/repo.png
									
									
									
									
										vendored
									
									
								
							
							
						
						| Before Width: | Height: | Size: 211 KiB | 
							
								
								
									
										
											BIN
										
									
								
								screenshots/soft-dark.png
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 202 KiB | 
							
								
								
									
										61
									
								
								src/core/chroma.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @@ -0,0 +1,61 @@ | |||||||
|  | import { prettylights2Chroma } from "./prettylights"; | ||||||
|  |  | ||||||
|  | export const defaultDarkChroma = prettylights2Chroma({ | ||||||
|  |   syntax: { | ||||||
|  |     brackethighlighter: { angle: "#9198a1", unmatched: "#f85149" }, | ||||||
|  |     carriage: { return: { bg: "#b62324", text: "#f0f6fc" } }, | ||||||
|  |     comment: "#9198a1", | ||||||
|  |     constant: "#79c0ff", | ||||||
|  |     constantOtherReferenceLink: "#a5d6ff", | ||||||
|  |     entity: "#d2a8ff", | ||||||
|  |     entityTag: "#7ee787", | ||||||
|  |     invalid: { illegal: { bg: "#8e1519", text: "#f0f6fc" } }, | ||||||
|  |     keyword: "#ff7b72", | ||||||
|  |     markup: { | ||||||
|  |       bold: "#f0f6fc", | ||||||
|  |       changed: { bg: "#5a1e02", text: "#ffdfb6" }, | ||||||
|  |       deleted: { bg: "#67060c", text: "#ffdcd7" }, | ||||||
|  |       heading: "#1f6feb", | ||||||
|  |       ignored: { bg: "#1158c7", text: "#f0f6fc" }, | ||||||
|  |       inserted: { bg: "#033a16", text: "#aff5b4" }, | ||||||
|  |       italic: "#f0f6fc", | ||||||
|  |       list: "#f2cc60", | ||||||
|  |     }, | ||||||
|  |     metaDiffRange: "#d2a8ff", | ||||||
|  |     storageModifierImport: "#f0f6fc", | ||||||
|  |     string: "#a5d6ff", | ||||||
|  |     stringRegexp: "#7ee787", | ||||||
|  |     sublimelinterGutterMark: "#3d444d", | ||||||
|  |     variable: "#ffa657", | ||||||
|  |   }, | ||||||
|  | }); | ||||||
|  |  | ||||||
|  | export const defaultLightChroma = prettylights2Chroma({ | ||||||
|  |   syntax: { | ||||||
|  |     brackethighlighter: { angle: "#59636e", unmatched: "#82071e" }, | ||||||
|  |     carriage: { return: { bg: "#cf222e", text: "#f6f8fa" } }, | ||||||
|  |     comment: "#59636e", | ||||||
|  |     constant: "#0550ae", | ||||||
|  |     constantOtherReferenceLink: "#0a3069", | ||||||
|  |     entity: "#6639ba", | ||||||
|  |     entityTag: "#0550ae", | ||||||
|  |     invalid: { illegal: { bg: "#82071e", text: "#f6f8fa" } }, | ||||||
|  |     keyword: "#cf222e", | ||||||
|  |     markup: { | ||||||
|  |       bold: "#1f2328", | ||||||
|  |       changed: { bg: "#ffd8b5", text: "#953800" }, | ||||||
|  |       deleted: { bg: "#ffebe9", text: "#82071e" }, | ||||||
|  |       heading: "#0550ae", | ||||||
|  |       ignored: { bg: "#0550ae", text: "#d1d9e0" }, | ||||||
|  |       inserted: { bg: "#dafbe1", text: "#116329" }, | ||||||
|  |       italic: "#1f2328", | ||||||
|  |       list: "#3b2300", | ||||||
|  |     }, | ||||||
|  |     metaDiffRange: "#8250df", | ||||||
|  |     storageModifierImport: "#1f2328", | ||||||
|  |     string: "#0a3069", | ||||||
|  |     stringRegexp: "#116329", | ||||||
|  |     sublimelinterGutterMark: "#818b98", | ||||||
|  |     variable: "#953800", | ||||||
|  |   }, | ||||||
|  | }); | ||||||
| @@ -2,7 +2,7 @@ import { rgba, saturate } from "polished"; | |||||||
| import { scaleColorLight } from "src/functions"; | import { scaleColorLight } from "src/functions"; | ||||||
| import type { Ansi, Chroma, Console, Diff, Github, Message, Named, Other, Primary, Secondary } from "src/types"; | import type { Ansi, Chroma, Console, Diff, Github, Message, Named, Other, Primary, Secondary } from "src/types"; | ||||||
| import { themeVars } from "src/types/vars"; | import { themeVars } from "src/types/vars"; | ||||||
| import { prettylightsDark, prettylightsLight } from "./prettylights"; | import { defaultDarkChroma, defaultLightChroma } from "./chroma"; | ||||||
| import type { Theme } from "./theme"; | import type { Theme } from "./theme"; | ||||||
|  |  | ||||||
| type ThemeColor = { | type ThemeColor = { | ||||||
| @@ -59,7 +59,7 @@ type ThemeColor = { | |||||||
| /** 定义颜色, 用于生成颜色主题 | /** 定义颜色, 用于生成颜色主题 | ||||||
|  * @example |  * @example | ||||||
|  * 文件名: "dark.css.ts" |  * 文件名: "dark.css.ts" | ||||||
|  * import type { Console, Diff, Other } from "src/types"; |  * import type { Console, Diff, Other, Github } from "src/types"; | ||||||
|  * import { defineTheme, themeVars } from "src"; |  * import { defineTheme, themeVars } from "src"; | ||||||
|  * |  * | ||||||
|  * const console: Console = { |  * const console: Console = { | ||||||
| @@ -78,6 +78,7 @@ type ThemeColor = { | |||||||
|  *   console, |  *   console, | ||||||
|  *   diff, |  *   diff, | ||||||
|  *   other, |  *   other, | ||||||
|  |  *   github, | ||||||
|  * }) |  * }) | ||||||
|  */ |  */ | ||||||
| export function defineTheme(themeColor: ThemeColor, chroma: Chroma | null = null): Theme { | export function defineTheme(themeColor: ThemeColor, chroma: Chroma | null = null): Theme { | ||||||
| @@ -341,7 +342,7 @@ export function defineTheme(themeColor: ThemeColor, chroma: Chroma | null = null | |||||||
|  |  | ||||||
|   return { |   return { | ||||||
|     isDarkTheme: themeColor.isDarkTheme.toString(), |     isDarkTheme: themeColor.isDarkTheme.toString(), | ||||||
|     chroma: chroma || (themeColor.isDarkTheme ? prettylightsDark : prettylightsLight), |     chroma: chroma || (themeColor.isDarkTheme ? defaultDarkChroma : defaultLightChroma), | ||||||
|     color: { |     color: { | ||||||
|       primary, |       primary, | ||||||
|       secondary, |       secondary, | ||||||
|   | |||||||
| @@ -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; |  | ||||||
|       }; |  | ||||||
|     }; |     }; | ||||||
|   }; |   }; | ||||||
| }; | }; | ||||||
|   | |||||||
| @@ -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; | ||||||
|     }; |     }; | ||||||
| @@ -150,113 +125,3 @@ export function prettylights2Chroma(prettylights: prettylightsColor): Chroma { | |||||||
|     }, |     }, | ||||||
|   }; |   }; | ||||||
| } | } | ||||||
|  |  | ||||||
| export const prettylightsDark = prettylights2Chroma({ |  | ||||||
|   syntax: { |  | ||||||
|     brackethighlighter: { |  | ||||||
|       angle: "#9198a1", |  | ||||||
|       unmatched: "#f85149", |  | ||||||
|     }, |  | ||||||
|     carriage: { |  | ||||||
|       return: { |  | ||||||
|         bg: "#b62324", |  | ||||||
|         text: "#f0f6fc", |  | ||||||
|       }, |  | ||||||
|     }, |  | ||||||
|     comment: "#9198a1", |  | ||||||
|     constant: "#79c0ff", |  | ||||||
|     constantOtherReferenceLink: "#a5d6ff", |  | ||||||
|     entity: "#d2a8ff", |  | ||||||
|     entityTag: "#7ee787", |  | ||||||
|     invalid: { |  | ||||||
|       illegal: { |  | ||||||
|         bg: "#8e1519", |  | ||||||
|         text: "#f0f6fc", |  | ||||||
|       }, |  | ||||||
|     }, |  | ||||||
|     keyword: "#ff7b72", |  | ||||||
|     markup: { |  | ||||||
|       bold: "#f0f6fc", |  | ||||||
|       changed: { |  | ||||||
|         bg: "#5a1e02", |  | ||||||
|         text: "#ffdfb6", |  | ||||||
|       }, |  | ||||||
|       deleted: { |  | ||||||
|         bg: "#67060c", |  | ||||||
|         text: "#ffdcd7", |  | ||||||
|       }, |  | ||||||
|       heading: "#1f6feb", |  | ||||||
|       ignored: { |  | ||||||
|         bg: "#1158c7", |  | ||||||
|         text: "#f0f6fc", |  | ||||||
|       }, |  | ||||||
|       inserted: { |  | ||||||
|         bg: "#033a16", |  | ||||||
|         text: "#aff5b4", |  | ||||||
|       }, |  | ||||||
|       italic: "#f0f6fc", |  | ||||||
|       list: "#f2cc60", |  | ||||||
|     }, |  | ||||||
|     metaDiffRange: "#d2a8ff", |  | ||||||
|     storageModifierImport: "#f0f6fc", |  | ||||||
|     string: "#a5d6ff", |  | ||||||
|     stringRegexp: "#7ee787", |  | ||||||
|     sublimelinterGutterMark: "#3d444d", |  | ||||||
|     variable: "#ffa657", |  | ||||||
|   } |  | ||||||
| }) |  | ||||||
|  |  | ||||||
| export const prettylightsLight = prettylights2Chroma({ |  | ||||||
|   syntax: { |  | ||||||
|     brackethighlighter: { |  | ||||||
|       angle: "#59636e", |  | ||||||
|       unmatched: "#82071e", |  | ||||||
|     }, |  | ||||||
|     carriage: { |  | ||||||
|       return: { |  | ||||||
|         bg: "#cf222e", |  | ||||||
|         text: "#f6f8fa", |  | ||||||
|       }, |  | ||||||
|     }, |  | ||||||
|     comment: "#59636e", |  | ||||||
|     constant: "#0550ae", |  | ||||||
|     constantOtherReferenceLink: "#0a3069", |  | ||||||
|     entity: "#6639ba", |  | ||||||
|     entityTag: "#0550ae", |  | ||||||
|     invalid: { |  | ||||||
|       illegal: { |  | ||||||
|         bg: "#82071e", |  | ||||||
|         text: "#f6f8fa", |  | ||||||
|       }, |  | ||||||
|     }, |  | ||||||
|     keyword: "#cf222e", |  | ||||||
|     markup: { |  | ||||||
|       bold: "#1f2328", |  | ||||||
|       changed: { |  | ||||||
|         bg: "#ffd8b5", |  | ||||||
|         text: "#953800", |  | ||||||
|       }, |  | ||||||
|       deleted: { |  | ||||||
|         bg: "#ffebe9", |  | ||||||
|         text: "#82071e", |  | ||||||
|       }, |  | ||||||
|       heading: "#0550ae", |  | ||||||
|       ignored: { |  | ||||||
|         bg: "#0550ae", |  | ||||||
|         text: "#d1d9e0", |  | ||||||
|       }, |  | ||||||
|       inserted: { |  | ||||||
|         bg: "#dafbe1", |  | ||||||
|         text: "#116329", |  | ||||||
|       }, |  | ||||||
|       italic: "#1f2328", |  | ||||||
|       list: "#3b2300", |  | ||||||
|     }, |  | ||||||
|     metaDiffRange: "#8250df", |  | ||||||
|     storageModifierImport: "#1f2328", |  | ||||||
|     string: "#0a3069", |  | ||||||
|     stringRegexp: "#116329", |  | ||||||
|     sublimelinterGutterMark: "#818b98", |  | ||||||
|     variable: "#953800", |  | ||||||
|   } |  | ||||||
| }) |  | ||||||
| @@ -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: { | ||||||
|   | |||||||
| @@ -1,6 +1,12 @@ | |||||||
| import type { CSSVarFunction } from "src/core/types"; | import type { CSSVarFunction } from "src/core/types"; | ||||||
|  |  | ||||||
| type CSSFallbackVar = `var(--${string}, ${string})`; | type CSSFallbackVar = `var(--${string}, ${string})`; | ||||||
|  | /** | ||||||
|  |  * 设置 CSS 变量的回退值 | ||||||
|  |  * @param cssvar `var(--${string})` | ||||||
|  |  * @param fallback | ||||||
|  |  * @returns `var(--${string}, fallback)` | ||||||
|  |  */ | ||||||
| export function fallbackVar(cssvar: CSSVarFunction, fallback: string): CSSFallbackVar { | export function fallbackVar(cssvar: CSSVarFunction, fallback: string): CSSFallbackVar { | ||||||
|   const var_name = cssvar.replace("var(--", "").replace(")", ""); |   const var_name = cssvar.replace("var(--", "").replace(")", ""); | ||||||
|   return `var(--${var_name}, ${fallback})`; |   return `var(--${var_name}, ${fallback})`; | ||||||
|   | |||||||
| @@ -1,3 +1,4 @@ | |||||||
| export { defineTheme } from "./core/color"; | export { defineTheme } from "./core/color"; | ||||||
| export type { Console, Diff, Other } from "./types"; | export type { Theme } from "./core/theme"; | ||||||
| export { themeVars } from "./types/vars"; | export type { Chroma, Console, Diff, Github, Other } from "./types"; | ||||||
|  | export { otherThemeVars, themeVars } from "./types/vars"; | ||||||
|   | |||||||
| @@ -29,6 +29,7 @@ export const github = { | |||||||
|        * @release `releaseTagMenu` 顶部栏左侧按钮激活背景色 |        * @release `releaseTagMenu` 顶部栏左侧按钮激活背景色 | ||||||
|        * @navbar `navbarRight` 头像管理员标识背景颜色 |        * @navbar `navbarRight` 头像管理员标识背景颜色 | ||||||
|        * @dropdown `dropdown` emoji 的悬停背景色 |        * @dropdown `dropdown` emoji 的悬停背景色 | ||||||
|  |        * @menu `paginationMenu` 分页菜单的激活背景色 | ||||||
|        */ |        */ | ||||||
|       emphasis: null, |       emphasis: null, | ||||||
|       /** 暗淡的背景颜色 |       /** 暗淡的背景颜色 | ||||||
| @@ -175,6 +176,7 @@ export const github = { | |||||||
|          * @menu `menu` 菜单项的悬停背景颜色 |          * @menu `menu` 菜单项的悬停背景颜色 | ||||||
|          * @repo `repoHeader` 仓库标题的悬停背景颜色 |          * @repo `repoHeader` 仓库标题的悬停背景颜色 | ||||||
|          * @commit `commit` 提交信息的 Action 按钮的悬停背景颜色 |          * @commit `commit` 提交信息的 Action 按钮的悬停背景颜色 | ||||||
|  |          * @filelist `repoFiles` README 栏的按钮的悬停背景颜色 | ||||||
|          */ |          */ | ||||||
|         hover: null, |         hover: null, | ||||||
|       }, |       }, | ||||||
| @@ -194,6 +196,7 @@ export const github = { | |||||||
|       /** 下划线导航栏的边框颜色 |       /** 下划线导航栏的边框颜色 | ||||||
|        * @clone `clone` 按钮组的按钮下划线颜色 |        * @clone `clone` 按钮组的按钮下划线颜色 | ||||||
|        * @menu `secondaryMenu` 二级菜单按钮的下划线颜色 |        * @menu `secondaryMenu` 二级菜单按钮的下划线颜色 | ||||||
|  |        * @filelist `repoFiles` README 栏的左边按钮下划线颜色 | ||||||
|        */ |        */ | ||||||
|       active: null, |       active: null, | ||||||
|     }, |     }, | ||||||
| @@ -201,17 +204,17 @@ export const github = { | |||||||
|   /** 热力图 */ |   /** 热力图 */ | ||||||
|   contribution: { |   contribution: { | ||||||
|     default: { |     default: { | ||||||
|  |       /** 热力图方块的颜色 */ | ||||||
|       bgColor: { |       bgColor: { | ||||||
|         num0: null, |         num0: null, | ||||||
|         num1: null, |         num1: null, | ||||||
|         num2: null, |         num2: null, | ||||||
|         num3: null, |         num3: null, | ||||||
|         num4: null, |         num4: null, | ||||||
|         /** github 无此颜色需自行计算 |         /** github 无此颜色需自行计算 */ | ||||||
|          * @example 可参考这个颜色 `--color-prettylights-syntax-string-regexp` |  | ||||||
|          */ |  | ||||||
|         num5: null, |         num5: null, | ||||||
|       }, |       }, | ||||||
|  |       /** 热力图方块的内边框颜色 */ | ||||||
|       borderColor: { |       borderColor: { | ||||||
|         num0: null, |         num0: null, | ||||||
|         num1: null, |         num1: null, | ||||||
|   | |||||||
| @@ -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, | ||||||
|   | |||||||
| @@ -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, |  | ||||||
| }; |  | ||||||
|   | |||||||
| @@ -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, | ||||||
| }; | }; | ||||||
|   | |||||||
| @@ -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()); | ||||||
|   | |||||||
| @@ -203,7 +203,7 @@ export const actionViewRight = css` | |||||||
|  |  | ||||||
|     .job-info-header { |     .job-info-header { | ||||||
|       padding: 16px 12px 16px 24px; |       padding: 16px 12px 16px 24px; | ||||||
|       height: auto; |       height: 80px; | ||||||
|  |  | ||||||
|       .job-info-header-title { |       .job-info-header-title { | ||||||
|         color: ${themeVars.github.fgColor.accent}; |         color: ${themeVars.github.fgColor.accent}; | ||||||
| @@ -220,6 +220,11 @@ export const actionViewRight = css` | |||||||
|         color: ${themeVars.color.console.fg.subtle}; |         color: ${themeVars.color.console.fg.subtle}; | ||||||
|         padding: 8px 10px; |         padding: 8px 10px; | ||||||
|  |  | ||||||
|  |         &.selected { | ||||||
|  |           // 滚动时固定在顶部的高度与 job-info-header 高度相同 | ||||||
|  |           top: 80px; | ||||||
|  |         } | ||||||
|  |  | ||||||
|         &.step-expandable:hover { |         &.step-expandable:hover { | ||||||
|           color: ${themeVars.color.console.fg.subtle}; |           color: ${themeVars.color.console.fg.subtle}; | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -34,7 +34,7 @@ export const diff = css` | |||||||
|  |  | ||||||
|     &:hover { |     &:hover { | ||||||
|       background: ${themeVars.github.bgColor.accent.emphasis}; |       background: ${themeVars.github.bgColor.accent.emphasis}; | ||||||
|       color: ${themeVars.color.white} |       color: ${themeVars.color.white}; | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|   /* 行号居中 */ |   /* 行号居中 */ | ||||||
|   | |||||||
| @@ -13,7 +13,8 @@ export const repoList = css` | |||||||
|   .page-content.user.profile > .ui.container > .ui.stackable > .ui.twelve, |   .page-content.user.profile > .ui.container > .ui.stackable > .ui.twelve, | ||||||
|   // 探索 |   // 探索 | ||||||
|   .page-content.explore.repositories > .ui.container { |   .page-content.explore.repositories > .ui.container { | ||||||
|     > .flex-list { |     // 排除用户的公开活动页 | ||||||
|  |     > .flex-list:not(#activity-feed) { | ||||||
|       display: grid; |       display: grid; | ||||||
|       > .flex-item { |       > .flex-item { | ||||||
|         border: 1px solid ${themeVars.color.light.border}; |         border: 1px solid ${themeVars.color.light.border}; | ||||||
| @@ -77,7 +78,8 @@ export const repoList = css` | |||||||
|     gap: min(${orgRepoVar} * 8px, 16px); |     gap: min(${orgRepoVar} * 8px, 16px); | ||||||
|   } |   } | ||||||
|   // 用户 |   // 用户 | ||||||
|   .page-content.user.profile > .ui.container > .ui.stackable > .ui.twelve > .flex-list { |   // 排除用户的公开活动页 | ||||||
|  |   .page-content.user.profile > .ui.container > .ui.stackable > .ui.twelve > .flex-list:not(#activity-feed) { | ||||||
|     grid-template-columns: repeat(${userRepoVar}, 1fr); |     grid-template-columns: repeat(${userRepoVar}, 1fr); | ||||||
|     gap: min(${userRepoVar} * 8px, 16px); |     gap: min(${userRepoVar} * 8px, 16px); | ||||||
|   } |   } | ||||||
| @@ -152,7 +154,8 @@ export const mobileList = css` | |||||||
|     .page-content.organization.members >.ui.container, |     .page-content.organization.members >.ui.container, | ||||||
|     // 探索的用户和组织列表 |     // 探索的用户和组织列表 | ||||||
|     .page-content.explore.users >.ui.container { |     .page-content.explore.users >.ui.container { | ||||||
|       > .flex-list { |       // 排除用户的公开活动页 | ||||||
|  |       > .flex-list:not(#activity-feed) { | ||||||
|         grid-template-columns: 1fr; |         grid-template-columns: 1fr; | ||||||
|         gap: 8px; |         gap: 8px; | ||||||
|       } |       } | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| import { css, themeVars } from "src/types/vars"; | import { css, otherThemeVars, themeVars } from "src/types/vars"; | ||||||
|  |  | ||||||
| // 文件列表页面下的分支按钮 | // 文件列表页面下的分支按钮 | ||||||
| export const branchButton = css` | export const branchButton = css` | ||||||
| @@ -75,6 +75,7 @@ export const repoFiles = css` | |||||||
|       // 文件列表 |       // 文件列表 | ||||||
|       .repo-file-item { |       .repo-file-item { | ||||||
|         .repo-file-cell { |         .repo-file-cell { | ||||||
|  |           height: 40px; | ||||||
|           &.name { |           &.name { | ||||||
|             display: flex; |             display: flex; | ||||||
|             align-items: center; |             align-items: center; | ||||||
| @@ -87,6 +88,39 @@ export const repoFiles = css` | |||||||
|         } |         } | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|  |     #readme { | ||||||
|  |       .file-header { | ||||||
|  |         background: ${themeVars.color.body}; | ||||||
|  |         svg { | ||||||
|  |           color: ${themeVars.color.text.light.num1}; | ||||||
|  |         } | ||||||
|  |         .file-header-left { | ||||||
|  |           padding: 6px 8px !important; | ||||||
|  |           &:hover { | ||||||
|  |             background: ${themeVars.github.control.transparent.bgColor.hover}; | ||||||
|  |             border-radius: ${otherThemeVars.border.radius}; | ||||||
|  |           } | ||||||
|  |           &:after { | ||||||
|  |             content: ""; | ||||||
|  |             background: ${themeVars.github.underlineNav.borderColor.active}; | ||||||
|  |             border-radius: ${otherThemeVars.border.radius}; | ||||||
|  |             bottom: 0; | ||||||
|  |             height: 2px; | ||||||
|  |             position: absolute; | ||||||
|  |             left: 12px; | ||||||
|  |             width: 113px; | ||||||
|  |           } | ||||||
|  |           a.muted:hover { | ||||||
|  |             color: inherit; | ||||||
|  |             text-decoration-line: none; | ||||||
|  |           } | ||||||
|  |         } | ||||||
|  |         .file-header-right:hover { | ||||||
|  |           background: ${themeVars.github.control.transparent.bgColor.hover}; | ||||||
|  |           border-radius: ${otherThemeVars.border.radius}; | ||||||
|  |         } | ||||||
|  |       } | ||||||
|  |     } | ||||||
|   } |   } | ||||||
| `; | `; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -120,6 +120,10 @@ export const selectionDropdown = css` | |||||||
|       ${activeItemAfterStyle}; |       ${activeItemAfterStyle}; | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |   // 修复顶部导航栏工单管理/请求合并页面搜索框旁的选择下拉框按钮内容过窄 | ||||||
|  |   .list-header-search .ui.action.input > .dropdown.small { | ||||||
|  |     padding: 8px 40px 8px 16px; | ||||||
|  |   } | ||||||
|   // 发布版本页面的分支按钮, 覆盖 Gitea 的样式, 避免按钮元素高度不一致 |   // 发布版本页面的分支按钮, 覆盖 Gitea 的样式, 避免按钮元素高度不一致 | ||||||
|   .repository.new.release .target .selection.dropdown { |   .repository.new.release .target .selection.dropdown { | ||||||
|     padding-top: 8px; |     padding-top: 8px; | ||||||
|   | |||||||
| @@ -193,3 +193,46 @@ export const secondaryMenu = css` | |||||||
|     } |     } | ||||||
|   } |   } | ||||||
| `; | `; | ||||||
|  |  | ||||||
|  | // 分页菜单 | ||||||
|  | export const paginationMenu = css` | ||||||
|  |   .ui.borderless.pagination.menu { | ||||||
|  |     background-color: unset; | ||||||
|  |     border: 0; | ||||||
|  |     gap: 4px; | ||||||
|  |     .item { | ||||||
|  |       border-radius: ${otherThemeVars.border.radius}; | ||||||
|  |       min-width: 32px; | ||||||
|  |       min-height: 32px; | ||||||
|  |       height: 32px; | ||||||
|  |       justify-content: center; | ||||||
|  |       // 避免一些 hover 效果调整内容 | ||||||
|  |       padding: 5px 10px !important; | ||||||
|  |       &.active { | ||||||
|  |         background: ${themeVars.github.bgColor.accent.emphasis}; | ||||||
|  |         color: ${themeVars.color.white}; | ||||||
|  |       } | ||||||
|  |       // 设置透明边框线避免 hover 时元素大小变化 | ||||||
|  |       &:not(.active) { | ||||||
|  |         border: 1px solid #ffffff00; | ||||||
|  |         &:hover { | ||||||
|  |           background: unset; | ||||||
|  |           border-color: ${themeVars.color.secondary.self}; | ||||||
|  |           transition-duration: 0.1s; | ||||||
|  |         } | ||||||
|  |       } | ||||||
|  |       &.navigation { | ||||||
|  |         &:not(.disabled) { | ||||||
|  |           span, | ||||||
|  |           svg { | ||||||
|  |             color: ${themeVars.color.primary.self}; | ||||||
|  |           } | ||||||
|  |         } | ||||||
|  |         // 对齐文字 | ||||||
|  |         svg { | ||||||
|  |           margin-top: 2px; | ||||||
|  |         } | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | `; | ||||||
|   | |||||||
| @@ -11,6 +11,9 @@ export const transition = css` | |||||||
|   .repo-file-cell, |   .repo-file-cell, | ||||||
|   // 差异对比的代码折叠按钮 |   // 差异对比的代码折叠按钮 | ||||||
|   .code-expander-button, |   .code-expander-button, | ||||||
|  |   // 仓库 README 头部的按钮 | ||||||
|  |   .file-header-left, | ||||||
|  |   .file-header-right, | ||||||
|   .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, | ||||||
|   | |||||||
| @@ -74,47 +74,22 @@ export default defineGithubTheme( | |||||||
|   }, |   }, | ||||||
|   prettylights2Chroma({ |   prettylights2Chroma({ | ||||||
|     syntax: { |     syntax: { | ||||||
|       brackethighlighter: { |       brackethighlighter: { angle: "#9198a1", unmatched: "#e5534b" }, | ||||||
|         angle: "#9198a1", |       carriage: { return: { bg: "#ad2e2c", text: "#f0f6fc" } }, | ||||||
|         unmatched: "#e5534b", |  | ||||||
|       }, |  | ||||||
|       carriage: { |  | ||||||
|         return: { |  | ||||||
|           bg: "#ad2e2c", |  | ||||||
|           text: "#f0f6fc", |  | ||||||
|         }, |  | ||||||
|       }, |  | ||||||
|       comment: "#9198a1", |       comment: "#9198a1", | ||||||
|       constant: "#6cb6ff", |       constant: "#6cb6ff", | ||||||
|       constantOtherReferenceLink: "#96d0ff", |       constantOtherReferenceLink: "#96d0ff", | ||||||
|       entity: "#dcbdfb", |       entity: "#dcbdfb", | ||||||
|       entityTag: "#8ddb8c", |       entityTag: "#8ddb8c", | ||||||
|       invalid: { |       invalid: { illegal: { bg: "#922323", text: "#f0f6fc" } }, | ||||||
|         illegal: { |  | ||||||
|           bg: "#922323", |  | ||||||
|           text: "#f0f6fc", |  | ||||||
|         }, |  | ||||||
|       }, |  | ||||||
|       keyword: "#f47067", |       keyword: "#f47067", | ||||||
|       markup: { |       markup: { | ||||||
|         bold: "#f0f6fc", |         bold: "#f0f6fc", | ||||||
|         changed: { |         changed: { bg: "#682d0f", text: "#ffddb0" }, | ||||||
|           bg: "#682d0f", |         deleted: { bg: "#78191b", text: "#ffd8d3" }, | ||||||
|           text: "#ffddb0", |  | ||||||
|         }, |  | ||||||
|         deleted: { |  | ||||||
|           bg: "#78191b", |  | ||||||
|           text: "#ffd8d3", |  | ||||||
|         }, |  | ||||||
|         heading: "#316dca", |         heading: "#316dca", | ||||||
|         ignored: { |         ignored: { bg: "#255ab2", text: "#f0f6fc" }, | ||||||
|           bg: "#255ab2", |         inserted: { bg: "#1b4721", text: "#b4f1b4" }, | ||||||
|           text: "#f0f6fc", |  | ||||||
|         }, |  | ||||||
|         inserted: { |  | ||||||
|           bg: "#1b4721", |  | ||||||
|           text: "#b4f1b4", |  | ||||||
|         }, |  | ||||||
|         italic: "#f0f6fc", |         italic: "#f0f6fc", | ||||||
|         list: "#eac55f", |         list: "#eac55f", | ||||||
|       }, |       }, | ||||||
|   | |||||||