Compare commits

...

14 Commits

Author SHA1 Message Date
lutinglt
73b5397d77 优化文件树的顶部和底部间隔 2025-08-16 20:58:10 +08:00
lutinglt
134c383cdb 优化查看代码文件内容时的体验 2025-08-16 20:51:07 +08:00
lutinglt
c6e73000bd 修复仓库中文 README 时的按钮下划线长度 2025-08-16 13:03:56 +08:00
lutinglt
dbf3547ad5 change default readme 2025-08-16 12:23:43 +08:00
lutinglt
5235dae367 更新英文截图 2025-08-16 12:19:11 +08:00
lutinglt
a9df7a31e1 README_EN 2025-08-16 12:03:10 +08:00
lutinglt
dd6e97be1d update readme 2025-08-15 10:53:02 +08:00
lutinglt
29f983cce6 update readme 2025-08-15 10:51:24 +08:00
鲁汀
fca10130a3 Create FUNDING.yml 2025-08-15 10:45:15 +08:00
lutinglt
8676816342 修复红绿色盲主题的代码高亮色 2025-08-15 09:15:13 +08:00
lutinglt
9bcea89fcb update readme 2025-08-14 23:31:41 +08:00
lutinglt
26deec78ff format code 2025-08-14 21:24:03 +08:00
lutinglt
ffb7fa810b 发布时的主题顺序 2025-08-14 20:51:56 +08:00
lutinglt
2083d3026b version 2025-08-14 20:37:00 +08:00
20 changed files with 274 additions and 49 deletions

15
.github/FUNDING.yml vendored Normal file
View File

@@ -0,0 +1,15 @@
# These are supported funding model platforms
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
polar: # Replace with a single Polar username
buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
thanks_dev: # Replace with a single thanks.dev username
custom: ['https://afdian.com/a/luting']

View File

@@ -1,11 +1,17 @@
## 🎉 ### 🎉
## ✨ Feature ### ✨ Feature
#### CSS 变量 #### CSS 变量
## 🌈 Style ### 🌈 Style
#### 更符合 GitHub 风格 ##### 更符合 GitHub 风格
## 🐞 Fix ### 🐞 Fix
## 📃 English
#### CSS Variable
##### More GitHub-like style

25
.github/release.md vendored
View File

@@ -1,8 +1,23 @@
## ✨ Feature ### 🌈 Style
- 支持色盲主题(Beta) ( 红绿色盲和蓝色盲 ) ( Colorblind & Tritanopia ) ##### 更符合 GitHub 风格
## 🐞 Fix - 优化查看代码文件内容时的体验 (滚动到底部时不会导致文件树部分内容遮挡)
- 查看代码文件页面路径栏有时内容不会居中 ### 🐞 Fix
- 查看代码文件页面文件树头部滚动到底部时不会固定住
- 修复红绿色盲主题的代码高亮色
- 修复仓库中文 README 时的按钮下划线长度
## 📃 English (From AI)
### 🌈 Style
##### More GitHub-like style
- Improved code file viewing experience (scrolling to bottom no longer causes file tree content overlap)
### 🐞 Fix
- Fixed code highlight colors for red-green color blindness theme
- Fixed button underline length for Chinese README in repositories

View File

@@ -19,9 +19,9 @@ jobs:
run: | run: |
export TZ=Asia/Shanghai export TZ=Asia/Shanghai
TAG="v$(npm run -s version)" TAG="v$(npm run -s version)"
tar -zcf dist/theme-github.tar.gz --remove-files dist/theme-github-auto.css dist/theme-github-light.css dist/theme-github-dark.css dist/theme-github-soft-dark.css tar -zcf dist/theme-github-base.tar.gz --remove-files dist/theme-github-auto.css dist/theme-github-light.css dist/theme-github-dark.css dist/theme-github-soft-dark.css
tar -zcf dist/theme-github-colorblind.tar.gz --remove-files dist/theme-github-colorblind-auto.css dist/theme-github-colorblind-light.css dist/theme-github-colorblind-dark.css tar -zcf dist/theme-github-colorblind.tar.gz --remove-files dist/theme-github-colorblind-auto.css dist/theme-github-colorblind-light.css dist/theme-github-colorblind-dark.css
tar -zcf dist/theme-github-tritanopia.tar.gz --remove-files dist/theme-github-tritanopia-auto.css dist/theme-github-tritanopia-light.css dist/theme-github-tritanopia-dark.css tar -zcf dist/theme-github-colorblind-tritanopia.tar.gz --remove-files dist/theme-github-tritanopia-auto.css dist/theme-github-tritanopia-light.css dist/theme-github-tritanopia-dark.css
gh release create "$TAG" dist/* --notes-file .github/release.md --draft -t $TAG gh release create "$TAG" dist/* --notes-file .github/release.md --draft -t $TAG
env: env:
GH_TOKEN: ${{ github.token }} GH_TOKEN: ${{ github.token }}

View File

@@ -95,8 +95,8 @@ npm run commit
请在颜色主题文件头部附加自己的作者信息, 方便 Issue 提问者找到你 `@`. 请在颜色主题文件头部附加自己的作者信息, 方便 Issue 提问者找到你 `@`.
推荐使用 `import { defineTheme, type ThemeColor } from "src"` 导入主题生成框架, 声明主题颜色, 然后使用 `defineTheme` 函数生成主题所有 CSS 变量, 推荐使用 `import { defineTheme, type ThemeColor } from "src"` 导入主题生成框架, 声明主题颜色, 然后使用 `defineTheme`
defineTheme 中设置了一些经过计算得到的 Gitea 变量可以减少工作量, 具体请查看函数说明和定义. 函数生成主题所有 CSS 变量, defineTheme 中设置了一些经过计算得到的 Gitea 变量可以减少工作量, 具体请查看函数说明和定义.
颜色计算函数可以从 `src/functions` 导入, 例如 `import { scaleColorLight } from "src/functions"`, 或者使用 `polished` 库. 颜色计算函数可以从 `src/functions` 导入, 例如 `import { scaleColorLight } from "src/functions"`, 或者使用 `polished` 库.

View File

@@ -1,3 +1,8 @@
<p align="center">
中文 |
<a href="./README_EN.md">English</a>
</p>
# gitea-github-theme # gitea-github-theme
一个精致模仿 Github 风格的 Gitea 主题 一个精致模仿 Github 风格的 Gitea 主题
@@ -15,7 +20,7 @@ Gitea 版本号格式: `1.大版本号.小版本号`
Gitea 理论上小版本号变更不会修改前端布局, 所以主题的小版本号适用于所有 Gitea 大版本号相同的 Gitea 版本. Gitea 理论上小版本号变更不会修改前端布局, 所以主题的小版本号适用于所有 Gitea 大版本号相同的 Gitea 版本.
比如: 主题版本 `1.24.4` 适用于 Gitea 版本 `>=1.24.0` ~ `<1.25.0` 比如: 主题版本 `1.24.5` 适用于 Gitea 版本 `>=1.24.0` `<1.25.0`
仅维护项目发布中的最新的 Gitea 版本, 其他旧版本主题不接受 Issue 和 PR. 仅维护项目发布中的最新的 Gitea 版本, 其他旧版本主题不接受 Issue 和 PR.
@@ -51,8 +56,9 @@ THEMES = gitea-auto, gitea-light, gitea-dark, github-auto, github-light, github-
```ini ```ini
THEMES = github-auto, github-light, github-dark, github-soft-dark THEMES = github-auto, github-light, github-dark, github-soft-dark
``` ```
<details open> <details open>
<summary>GitHub</summary> <summary>Base</summary>
<h4>theme-github-light.css</h4> <h4>theme-github-light.css</h4>
<img src="screenshots/light.png"/> <img src="screenshots/light.png"/>
<h4>theme-github-dark.css</h4> <h4>theme-github-dark.css</h4>
@@ -69,7 +75,7 @@ THEMES = github-tritanopia-auto, github-tritanopia-light, github-tritanopia-dark
``` ```
<details> <details>
<summary>红绿色盲 & 蓝色盲 ( Colorblind & Tritanopia )</summary> <summary>Colorblind & Tritanopia (红绿色盲 & 蓝色盲)</summary>
<h4>theme-github-colorblind-light.css & theme-github-tritanopia-light.css</h4> <h4>theme-github-colorblind-light.css & theme-github-tritanopia-light.css</h4>
<img src="screenshots/colorblind-light.png"/> <img src="screenshots/colorblind-light.png"/>
<h4>theme-github-colorblind-dark.css & theme-github-tritanopia-dark.css</h4> <h4>theme-github-colorblind-dark.css & theme-github-tritanopia-dark.css</h4>
@@ -103,7 +109,7 @@ THEMES = github-tritanopia-auto, github-tritanopia-light, github-tritanopia-dark
| 变量名 | 描述 | 默认 | 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 | | |

141
README_EN.md Normal file
View File

@@ -0,0 +1,141 @@
<p align="center">
<a href="./README.md">中文</a> |
English
</p>
# gitea-github-theme
A meticulously crafted Gitea theme that mimics the GitHub style
> [!TIP]
>
> For the best experience, it is recommended to use this theme with the file explorer icon plugin
> [web-file-explorer-icons](https://github.com/catppuccin/web-file-explorer-icons)
## Version Number Explanation
The theme version number is kept consistent with the Gitea version number
Gitea version number format: `1.major.minor`
Theoretically, minor version changes in Gitea do not modify the frontend layout, so the minor version of the theme is
applicable to all Gitea versions with the same major version number.
For example: Theme version `1.24.5` is applicable to Gitea versions `>=1.24.0` `<1.25.0`
Only the latest released Gitea version is maintained. Issues and PRs for other older theme versions will not be
accepted.
> Development stage theme version number format: `1.major.minor.timestamp`
## Installation
1. Download the latest CSS theme file from the release page and place it in the `gitea/public/assets/css` directory
2. Modify `gitea/conf/app.ini` and append the CSS filename without the `theme-` prefix to the end of `THEMES` under the
`[ui]` section
3. Restart Gitea
4. Check the theme in the settings
> [!IMPORTANT]
>
> Automatic color theme requires both light and dark theme files
Example: If the theme filename is `theme-github-dark.css`, add `github-dark` to the end of `THEMES`
Example `gitea/conf/app.ini`:
```ini
[ui]
THEMES = gitea-auto, gitea-light, gitea-dark, github-auto, github-light, github-dark, github-soft-dark
```
For details, please refer to the Gitea documentation
[Gitea docs](https://docs.gitea.com/next/administration/customizing-gitea#customizing-the-look-of-gitea)
## Screenshots
### Basic Themes
```ini
THEMES = github-auto, github-light, github-dark, github-soft-dark
```
<details open>
<summary>Base</summary>
<h4>theme-github-light.css</h4>
<img src="screenshots/en/light.png"/>
<h4>theme-github-dark.css</h4>
<img src="screenshots/en/dark.png"/>
<h4>theme-github-soft-dark.css</h4>
<img src="screenshots/en/soft-dark.png"/>
</details>
### Colorblind Themes (Beta)
```ini
THEMES = github-colorblind-auto, github-colorblind-light, github-colorblind-dark
THEMES = github-tritanopia-auto, github-tritanopia-light, github-tritanopia-dark
```
<details>
<summary>Colorblind & Tritanopia</summary>
<h4>theme-github-colorblind-light.css & theme-github-tritanopia-light.css</h4>
<img src="screenshots/en/colorblind-light.png"/>
<h4>theme-github-colorblind-dark.css & theme-github-tritanopia-dark.css</h4>
<img src="screenshots/en/colorblind-dark.png"/>
</details>
## Custom CSS Variables
You can customize parts of the theme style according to your preferences
### Usage Method
Add the following code at the beginning or end of the theme's CSS file
```css
:root {
--custom-clone-menu-width: 150px;
...
}
```
> [!IMPORTANT]
>
> Please ensure to add custom variables in the `:root` selector, otherwise they will not take effect
>
> Variables are separated by `;`
>
> It is recommended to place custom variables in a separate file and append them to the theme file using shell commands
> or other methods
### CSS Variables
| Variable Name | Description | Default | Github | Recommend | Min | Max |
| :-------------------------------- | :------------------------------------------------------- | :------ | :----- | :-------- | :---- | :---- |
| --custom-clone-menu-width | Clone button menu width | Gitea | 332px | 200px | 150px | 400px |
| --custom-explore-repolist-columns | Number of repository list columns on explore page | 2 | 2 | 2 | | |
| --custom-explore-userlist-columns | Number of user/organization list columns on explore page | 3 | 1 | 2/3 | | |
| --custom-user-repolist-columns | Number of repository list columns on user page | 2 | 2 | 1/2 | | |
| --custom-org-repolist-columns | Number of repository list columns on organization page | 1 | 1 | 1/2 | | |
| --custom-org-userlist-columns | Number of user list columns on organization page | 2 | 1 | 1/2 | | |
## Using Development Version of the Theme
You might want to use the development version of the theme instead of the released version
Please ensure you have Node.js environment installed, Node.js 20 or above is recommended
```bash
git clone https://github.com/lutinglt/gitea-github-theme.git
cd gitea-github-theme
npm install
npm run build
```
After compilation, theme files will be generated in the `dist` directory. You can place the theme files into the
`gitea/public/assets/css` directory, then add the theme name to the end of `THEMES` in `gitea/conf/app.ini`
## Contribution
Please refer to [CONTRIBUTING](CONTRIBUTING.md)

View File

@@ -1,7 +1,7 @@
{ {
"name": "gitea-github-theme", "name": "gitea-github-theme",
"version": "1.24.5", "version": "1.24.6",
"description": "A theme to make Gitea look and feel like GitHub", "description": "A sophisticated theme to make Gitea look and feel like GitHub",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite build --mode dev", "dev": "vite build --mode dev",

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 KiB

BIN
screenshots/en/dark.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 KiB

BIN
screenshots/en/light.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 KiB

View File

@@ -84,7 +84,7 @@ export type ThemeColor = {
* github, * github,
* }) * })
*/ */
export function defineTheme(themeColor: ThemeColor, chroma: Chroma | null = null): Theme { export function defineTheme(themeColor: ThemeColor, chroma?: Chroma): Theme {
const brightDir = themeColor.isDarkTheme ? -1 : 1; const brightDir = themeColor.isDarkTheme ? -1 : 1;
const primary: Primary = { const primary: Primary = {
@@ -165,7 +165,9 @@ export function defineTheme(themeColor: ThemeColor, chroma: Chroma | null = null
const named: Named = { const named: Named = {
red: { red: {
self: themeColor.base.red, self: themeColor.base.red,
light: themeColor.isDarkTheme ? scaleColorLight(themeColor.base.red, 15) : scaleColorLight(themeColor.base.red, 25), light: themeColor.isDarkTheme
? scaleColorLight(themeColor.base.red, 15)
: scaleColorLight(themeColor.base.red, 25),
dark: { dark: {
num1: scaleColorLight(themeColor.base.red, -10), num1: scaleColorLight(themeColor.base.red, -10),
num2: scaleColorLight(themeColor.base.red, -20), num2: scaleColorLight(themeColor.base.red, -20),
@@ -180,7 +182,9 @@ export function defineTheme(themeColor: ThemeColor, chroma: Chroma | null = null
}, },
orange: { orange: {
self: themeColor.base.orange, self: themeColor.base.orange,
light: themeColor.isDarkTheme ? scaleColorLight(themeColor.base.orange, 15) : scaleColorLight(themeColor.base.orange, 25), light: themeColor.isDarkTheme
? scaleColorLight(themeColor.base.orange, 15)
: scaleColorLight(themeColor.base.orange, 25),
dark: { dark: {
num1: scaleColorLight(themeColor.base.orange, -10), num1: scaleColorLight(themeColor.base.orange, -10),
num2: scaleColorLight(themeColor.base.orange, -20), num2: scaleColorLight(themeColor.base.orange, -20),
@@ -195,7 +199,9 @@ export function defineTheme(themeColor: ThemeColor, chroma: Chroma | null = null
}, },
yellow: { yellow: {
self: themeColor.base.yellow, self: themeColor.base.yellow,
light: themeColor.isDarkTheme ? scaleColorLight(themeColor.base.yellow, 15) : scaleColorLight(themeColor.base.yellow, 25), light: themeColor.isDarkTheme
? scaleColorLight(themeColor.base.yellow, 15)
: scaleColorLight(themeColor.base.yellow, 25),
dark: { dark: {
num1: scaleColorLight(themeColor.base.yellow, -10), num1: scaleColorLight(themeColor.base.yellow, -10),
num2: scaleColorLight(themeColor.base.yellow, -20), num2: scaleColorLight(themeColor.base.yellow, -20),
@@ -210,7 +216,9 @@ export function defineTheme(themeColor: ThemeColor, chroma: Chroma | null = null
}, },
olive: { olive: {
self: themeColor.base.olive, self: themeColor.base.olive,
light: themeColor.isDarkTheme ? scaleColorLight(themeColor.base.olive, 15) : scaleColorLight(themeColor.base.olive, 25), light: themeColor.isDarkTheme
? scaleColorLight(themeColor.base.olive, 15)
: scaleColorLight(themeColor.base.olive, 25),
dark: { dark: {
num1: scaleColorLight(themeColor.base.olive, -10), num1: scaleColorLight(themeColor.base.olive, -10),
num2: scaleColorLight(themeColor.base.olive, -20), num2: scaleColorLight(themeColor.base.olive, -20),
@@ -218,7 +226,9 @@ export function defineTheme(themeColor: ThemeColor, chroma: Chroma | null = null
}, },
green: { green: {
self: themeColor.base.green, self: themeColor.base.green,
light: themeColor.isDarkTheme ? scaleColorLight(themeColor.base.green, 15) : scaleColorLight(themeColor.base.green, 25), light: themeColor.isDarkTheme
? scaleColorLight(themeColor.base.green, 15)
: scaleColorLight(themeColor.base.green, 25),
dark: { dark: {
num1: scaleColorLight(themeColor.base.green, -10), num1: scaleColorLight(themeColor.base.green, -10),
num2: scaleColorLight(themeColor.base.green, -20), num2: scaleColorLight(themeColor.base.green, -20),
@@ -233,7 +243,9 @@ export function defineTheme(themeColor: ThemeColor, chroma: Chroma | null = null
}, },
teal: { teal: {
self: themeColor.base.teal, self: themeColor.base.teal,
light: themeColor.isDarkTheme ? scaleColorLight(themeColor.base.teal, 15) : scaleColorLight(themeColor.base.teal, 25), light: themeColor.isDarkTheme
? scaleColorLight(themeColor.base.teal, 15)
: scaleColorLight(themeColor.base.teal, 25),
dark: { dark: {
num1: scaleColorLight(themeColor.base.teal, -10), num1: scaleColorLight(themeColor.base.teal, -10),
num2: scaleColorLight(themeColor.base.teal, -20), num2: scaleColorLight(themeColor.base.teal, -20),
@@ -241,7 +253,9 @@ export function defineTheme(themeColor: ThemeColor, chroma: Chroma | null = null
}, },
blue: { blue: {
self: themeColor.base.blue, self: themeColor.base.blue,
light: themeColor.isDarkTheme ? scaleColorLight(themeColor.base.blue, 15) : scaleColorLight(themeColor.base.blue, 25), light: themeColor.isDarkTheme
? scaleColorLight(themeColor.base.blue, 15)
: scaleColorLight(themeColor.base.blue, 25),
dark: { dark: {
num1: scaleColorLight(themeColor.base.blue, -10), num1: scaleColorLight(themeColor.base.blue, -10),
num2: scaleColorLight(themeColor.base.blue, -20), num2: scaleColorLight(themeColor.base.blue, -20),
@@ -249,7 +263,9 @@ export function defineTheme(themeColor: ThemeColor, chroma: Chroma | null = null
}, },
violet: { violet: {
self: themeColor.base.violet, self: themeColor.base.violet,
light: themeColor.isDarkTheme ? scaleColorLight(themeColor.base.violet, 15) : scaleColorLight(themeColor.base.violet, 25), light: themeColor.isDarkTheme
? scaleColorLight(themeColor.base.violet, 15)
: scaleColorLight(themeColor.base.violet, 25),
dark: { dark: {
num1: scaleColorLight(themeColor.base.violet, -10), num1: scaleColorLight(themeColor.base.violet, -10),
num2: scaleColorLight(themeColor.base.violet, -20), num2: scaleColorLight(themeColor.base.violet, -20),
@@ -257,7 +273,9 @@ export function defineTheme(themeColor: ThemeColor, chroma: Chroma | null = null
}, },
purple: { purple: {
self: themeColor.base.purple, self: themeColor.base.purple,
light: themeColor.isDarkTheme ? scaleColorLight(themeColor.base.purple, 15) : scaleColorLight(themeColor.base.purple, 25), light: themeColor.isDarkTheme
? scaleColorLight(themeColor.base.purple, 15)
: scaleColorLight(themeColor.base.purple, 25),
dark: { dark: {
num1: scaleColorLight(themeColor.base.purple, -10), num1: scaleColorLight(themeColor.base.purple, -10),
num2: scaleColorLight(themeColor.base.purple, -20), num2: scaleColorLight(themeColor.base.purple, -20),
@@ -265,7 +283,9 @@ export function defineTheme(themeColor: ThemeColor, chroma: Chroma | null = null
}, },
pink: { pink: {
self: themeColor.base.pink, self: themeColor.base.pink,
light: themeColor.isDarkTheme ? scaleColorLight(themeColor.base.pink, 15) : scaleColorLight(themeColor.base.pink, 25), light: themeColor.isDarkTheme
? scaleColorLight(themeColor.base.pink, 15)
: scaleColorLight(themeColor.base.pink, 25),
dark: { dark: {
num1: scaleColorLight(themeColor.base.pink, -10), num1: scaleColorLight(themeColor.base.pink, -10),
num2: scaleColorLight(themeColor.base.pink, -20), num2: scaleColorLight(themeColor.base.pink, -20),
@@ -273,7 +293,9 @@ export function defineTheme(themeColor: ThemeColor, chroma: Chroma | null = null
}, },
brown: { brown: {
self: themeColor.base.brown, self: themeColor.base.brown,
light: themeColor.isDarkTheme ? scaleColorLight(themeColor.base.brown, 15) : scaleColorLight(themeColor.base.brown, 25), light: themeColor.isDarkTheme
? scaleColorLight(themeColor.base.brown, 15)
: scaleColorLight(themeColor.base.brown, 25),
dark: { dark: {
num1: scaleColorLight(themeColor.base.brown, -10), num1: scaleColorLight(themeColor.base.brown, -10),
num2: scaleColorLight(themeColor.base.brown, -20), num2: scaleColorLight(themeColor.base.brown, -20),
@@ -281,7 +303,9 @@ export function defineTheme(themeColor: ThemeColor, chroma: Chroma | null = null
}, },
black: { black: {
self: themeColor.base.black, self: themeColor.base.black,
light: themeColor.isDarkTheme ? scaleColorLight(themeColor.base.black, 15) : scaleColorLight(themeColor.base.black, 25), light: themeColor.isDarkTheme
? scaleColorLight(themeColor.base.black, 15)
: scaleColorLight(themeColor.base.black, 25),
dark: { dark: {
num1: scaleColorLight(themeColor.base.black, -10), num1: scaleColorLight(themeColor.base.black, -10),
num2: scaleColorLight(themeColor.base.black, -20), num2: scaleColorLight(themeColor.base.black, -20),
@@ -289,7 +313,9 @@ export function defineTheme(themeColor: ThemeColor, chroma: Chroma | null = null
}, },
grey: { grey: {
self: themeColor.base.grey, self: themeColor.base.grey,
light: themeColor.isDarkTheme ? scaleColorLight(themeColor.base.grey, 15) : scaleColorLight(themeColor.base.grey, 25), light: themeColor.isDarkTheme
? scaleColorLight(themeColor.base.grey, 15)
: scaleColorLight(themeColor.base.grey, 25),
}, },
gold: themeColor.base.gold, gold: themeColor.base.gold,
white: themeColor.base.white, white: themeColor.base.white,
@@ -338,7 +364,9 @@ export function defineTheme(themeColor: ThemeColor, chroma: Chroma | null = null
yellow: themeVars.color.yellow.light, yellow: themeVars.color.yellow.light,
blue: themeVars.color.blue.light, blue: themeVars.color.blue.light,
magenta: themeVars.color.pink.light, magenta: themeVars.color.pink.light,
cyan: themeColor.isDarkTheme ? scaleColorLight(themeColor.base.cyan, 10) : scaleColorLight(themeColor.base.cyan, 25), cyan: themeColor.isDarkTheme
? scaleColorLight(themeColor.base.cyan, 10)
: scaleColorLight(themeColor.base.cyan, 25),
white: themeVars.color.console.fg.self, white: themeVars.color.console.fg.self,
}, },
}; };

View File

@@ -73,7 +73,7 @@ export function prettylights2Chroma(prettylights: prettylightsColor): Chroma {
string: { string: {
self: prettylights.syntax.string, self: prettylights.syntax.string,
affix: prettylights.syntax.string, affix: prettylights.syntax.string,
backtick: prettylights.syntax.string, backtick: prettylights.syntax.constant,
char: prettylights.syntax.string, char: prettylights.syntax.string,
delimiter: prettylights.syntax.string, delimiter: prettylights.syntax.string,
doc: prettylights.syntax.comment, doc: prettylights.syntax.comment,

View File

@@ -96,6 +96,8 @@ export const repoFiles = css`
} }
.file-header-left { .file-header-left {
padding: 6px 8px !important; padding: 6px 8px !important;
// 伪元素宽度等于按钮宽度而不是父元素宽度
position: relative;
&:hover { &:hover {
background: ${themeVars.github.control.transparent.bgColor.hover}; background: ${themeVars.github.control.transparent.bgColor.hover};
border-radius: ${otherThemeVars.border.radius}; border-radius: ${otherThemeVars.border.radius};
@@ -104,11 +106,11 @@ export const repoFiles = css`
content: ""; content: "";
background: ${themeVars.github.underlineNav.borderColor.active}; background: ${themeVars.github.underlineNav.borderColor.active};
border-radius: ${otherThemeVars.border.radius}; border-radius: ${otherThemeVars.border.radius};
bottom: 0; bottom: -8px;
left: 0;
height: 2px; height: 2px;
position: absolute; position: absolute;
left: 12px; width: 100%;
width: 113px;
} }
a.muted:hover { a.muted:hover {
color: inherit; color: inherit;
@@ -146,6 +148,13 @@ export const repoFilesMobile = css`
// 仓库打开文件时的视图 // 仓库打开文件时的视图
export const repoFileView = css` export const repoFileView = css`
// 隐藏主内容的下内容和页脚, 避免滚动文件树时滚动条遮挡
body > .full.height:has(.repo-view-file-tree-container) {
padding-bottom: 0;
+ .page-footer {
display: none;
}
}
.page-content.repository.file.list { .page-content.repository.file.list {
> .ui.container.fluid { > .ui.container.fluid {
max-width: calc(100% - calc(2 * 16px)); max-width: calc(100% - calc(2 * 16px));
@@ -155,16 +164,17 @@ export const repoFileView = css`
top: 0; top: 0;
// 左侧文件树 // 左侧文件树
.repo-view-file-tree-container { .repo-view-file-tree-container {
height: 100vh; height: calc(100vh - 64px); // 减去头部高度
// 固定头部
position: sticky; position: sticky;
top: 0; top: 0;
&:after { &:after {
content: ""; content: "";
position: absolute; position: absolute;
top: -14px; top: -14px; // 导航栏元素的偏移高度补齐
right: 0; right: 0;
width: 1px; width: 1.5;
height: calc(100% + 14px); height: calc(100% + 14px + 64px); // 导航栏偏移高度 + 头部高度
background: ${themeVars.color.secondary.self}; background: ${themeVars.color.secondary.self};
} }
> .repo-button-row { > .repo-button-row {
@@ -172,6 +182,7 @@ export const repoFileView = css`
background: ${themeVars.color.body}; background: ${themeVars.color.body};
height: 64px; height: 64px;
margin: 0; margin: 0;
// 固定头部, 早期父元素有多余的页脚和内容高度导致滚动时无法固定, 修复后也可保留此属性无需删除
position: sticky; position: sticky;
top: 0; top: 0;
&:after { &:after {
@@ -186,11 +197,12 @@ export const repoFileView = css`
} }
.view-file-tree-items { .view-file-tree-items {
margin-right: 0; margin-right: 0;
padding: 16px 16px 16px 0; padding: 12px 16px 8px 0;
} }
} }
// 右侧文件视图内容 // 右侧文件视图内容
.repo-view-content { .repo-view-content {
padding-bottom: 40px;
.repo-button-row { .repo-button-row {
align-content: center; align-content: center;
background: ${themeVars.color.box.header}; background: ${themeVars.color.box.header};

View File

@@ -1,8 +1,10 @@
import "./actions"; import "./actions";
import "./chroma";
import "./clone"; import "./clone";
import "./commit"; import "./commit";
import "./dashboard"; import "./dashboard";
import "./diff"; import "./diff";
import "./editor";
import "./explore"; import "./explore";
import "./filelist"; import "./filelist";
import "./heatmap"; import "./heatmap";
@@ -14,5 +16,3 @@ import "./repo";
import "./setting"; import "./setting";
import "./signin"; import "./signin";
import "./user"; import "./user";
import "./chroma";
import "./editor"

View File

@@ -1,4 +1,4 @@
import { css, themeVars, otherThemeVars } from "src/types/vars"; import { css, otherThemeVars, themeVars } from "src/types/vars";
export const attached = css` export const attached = css`
// 设置右面板的内容 // 设置右面板的内容

View File

@@ -37,6 +37,7 @@ export const colorblindDarkGithubColors: GithubColor = {
underlineNav: darkGithubColors.underlineNav, underlineNav: darkGithubColors.underlineNav,
contribution: darkGithubColors.contribution, contribution: darkGithubColors.contribution,
}; };
export const colorblindDarkPrettylights: prettylightsColor = { export const colorblindDarkPrettylights: prettylightsColor = {
syntax: { syntax: {
brackethighlighter: { angle: "#9198a1", unmatched: "#db6d28" }, brackethighlighter: { angle: "#9198a1", unmatched: "#db6d28" },
@@ -70,4 +71,4 @@ export const colorblindDarkPrettylights: prettylightsColor = {
export const colorblindDarkColors: ThemeColor = github2ThemeColor(colorblindDarkGithubColors); export const colorblindDarkColors: ThemeColor = github2ThemeColor(colorblindDarkGithubColors);
export const colorblindDarkChroma: Chroma = prettylights2Chroma(colorblindDarkPrettylights); export const colorblindDarkChroma: Chroma = prettylights2Chroma(colorblindDarkPrettylights);
export default defineTheme(colorblindDarkColors); export default defineTheme(colorblindDarkColors, colorblindDarkChroma);

View File

@@ -37,6 +37,7 @@ export const colorblindLightGithubColors: GithubColor = {
underlineNav: lightGithubColors.underlineNav, underlineNav: lightGithubColors.underlineNav,
contribution: lightGithubColors.contribution, contribution: lightGithubColors.contribution,
}; };
export const colorblindLightPrettylights: prettylightsColor = { export const colorblindLightPrettylights: prettylightsColor = {
syntax: { syntax: {
brackethighlighter: { angle: "#59636e", unmatched: "#762c00" }, brackethighlighter: { angle: "#59636e", unmatched: "#762c00" },
@@ -70,4 +71,4 @@ export const colorblindLightPrettylights: prettylightsColor = {
export const colorblindLightColors: ThemeColor = github2ThemeColor(colorblindLightGithubColors); export const colorblindLightColors: ThemeColor = github2ThemeColor(colorblindLightGithubColors);
export const colorblindLightChroma: Chroma = prettylights2Chroma(colorblindLightPrettylights); export const colorblindLightChroma: Chroma = prettylights2Chroma(colorblindLightPrettylights);
export default defineTheme(colorblindLightColors); export default defineTheme(colorblindLightColors, colorblindLightChroma);