Compare commits

...

23 Commits

Author SHA1 Message Date
lutinglt
8e1a01e444 修改编译流程 2025-02-22 10:18:32 +08:00
lutinglt
4365603d56 代码结构调整 2025-02-22 09:53:29 +08:00
lutinglt
8def32e5b9 调整代码结构以支持多种风格 2025-02-21 21:47:54 +08:00
lutinglt
ba895a3f31 Update README.md 2025-02-19 22:38:52 +08:00
lutinglt
04896a3395 支持nodejs 2025-02-19 22:37:25 +08:00
lutinglt
69e0c063de .editorconfig 2025-02-19 12:05:24 +08:00
lutinglt
ce462ff305 Update 2025-02-19 11:53:36 +08:00
lutinglt
af2c71b607 代码布局调整 2025-02-19 11:41:33 +08:00
lutinglt
6a17010a5f 就这样吧 2025-02-19 08:36:57 +08:00
lutinglt
49812f0ee0 Ful佬说的对 2025-02-17 22:22:28 +08:00
lutinglt
5bba897e11 Ful佬说的对 2025-02-17 22:13:15 +08:00
lutinglt
bed93d8777 简化 2025-02-14 00:40:18 +08:00
lutinglt
d83f8e9e10 版本号更改 2025-02-13 01:38:47 +08:00
lutinglt
3ab8c04dee deno 2025-02-13 01:38:00 +08:00
lutinglt
14d79f4e9d deno@v2 2025-02-13 01:32:29 +08:00
lutinglt
d95b59512b deno? 2025-02-13 01:29:08 +08:00
lutinglt
79a1049090 修复工作流 2025-02-13 01:24:45 +08:00
lutinglt
34f72da8b5 nodejs->deno 2025-02-13 01:13:32 +08:00
lutinglt
c0d181278f 发布流程简化 2025-02-12 14:10:25 +08:00
lutinglt
b8d0e43074 Action执行时间位置优化 2025-02-11 12:49:34 +08:00
lutinglt
79f305ee1e 仓库导航栏文字颜色优化 2025-02-11 12:47:07 +08:00
lutinglt
9acfd21a9d Update README.md 2025-02-11 11:11:51 +08:00
lutinglt
a897230f2c 修复英文下Action页面执行时间换行&菜单文字粗细样式优化 2025-02-11 11:06:44 +08:00
40 changed files with 200 additions and 87 deletions

20
.editorconfig Normal file
View File

@@ -0,0 +1,20 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# EditorConfig is awesome: https://EditorConfig.org
root = true
[*]
charset = utf-8
indent_size = 2
indent_style = space
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[*.{css,scss,ts}]
max_line_length = 120
# documentation, utils
[*.{md,mdx,diff}]
trim_trailing_whitespace = false

3
.github/release.md vendored
View File

@@ -2,4 +2,5 @@
#### 更符合 GitHub 风格
- Action工作流页面同步
- 仓库导航栏文字颜色优化
- Action执行时间位置优化

View File

@@ -2,10 +2,6 @@ name: release
on:
workflow_dispatch:
inputs:
gitea_version:
required: true
type: string
permissions:
contents: write
@@ -15,21 +11,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: denoland/setup-deno@v2
with:
node-version: 20
- name: Build theme
run: |
npm install
npm run build
- uses: actions/upload-artifact@v4
with:
name: theme-github
path: dist/*
deno-version: v2.x
- name: Create release
run: |
export TZ=Asia/Shanghai
TAG="v${{ inputs.gitea_version }}-$(date +%Y%m%d-%H%M)"
TAG="v$(./build.ts).$(date +%y%m%d%H%M)"
gh release create "$TAG" dist/* --notes-file .github/release.md --draft -t $TAG
env:
GH_TOKEN: ${{ github.token }}

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
dist
node_modules
deno.lock
package-lock.json

View File

@@ -1,3 +1,5 @@
dist/
node_modules/
package-lock.json
deno.json
deno.lock

View File

@@ -3,7 +3,7 @@
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": true,
"singleQuote": false,
"quoteProps": "as-needed",
"jsxSingleQuote": false,
"trailingComma": "none",
@@ -13,4 +13,4 @@
"proseWrap": "always",
"htmlWhitespaceSensitivity": "css",
"endOfLine": "lf"
}
}

7
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,7 @@
| 目录 | 说明 |
| ----------------- | ---------------------------- |
| styles | 元素 GitHub 风格 |
| styles/components | 具体页面的元素单独风格 |
| styles/public | 适用大部分页面的元素默认风格 |
| themes | 颜色主题 |
| themes/\<theme> | 具体颜色主题自己的颜色或风格 |

View File

@@ -2,11 +2,13 @@
尽量保持与 GitHub Dark 相同样式的 Gitea 主题
### 主题说明
添加了短暂的过渡动画优化体验(与 GitHub Code 克隆列表动画一致)
推荐搭配文件图标浏览器插件一起使用更佳
[github-file-explorer-icons](https://github.com/catppuccin/github-file-explorer-icons)
## 安装
1. 在发布页下载最新的 `theme-github.css` 放入 `gitea/public/assets/css` 目录下
@@ -15,12 +17,14 @@
4. 在设置中查看主题
`gitea/conf/app.ini` 例:
```ini
[ui]
THEMES = gitea-dark, github
```
详细请查看 Gitea 文档 [Gitea docs](https://docs.gitea.com/next/administration/customizing-gitea#customizing-the-look-of-gitea)
详细请查看 Gitea 文档
[Gitea docs](https://docs.gitea.com/next/administration/customizing-gitea#customizing-the-look-of-gitea)
## 截图
@@ -40,23 +44,28 @@ THEMES = gitea-dark, github
## 构建
需要 nodejs 和 npm
### 克隆仓库
```bash
git clone https://github.com/lutinglt/gitea-github-theme.git
cd gitea-github-theme
```
### 使用 deno (推荐)
```bash
deno run build
```
### 使用 nodejs & npm
```bash
npm install
npm run build
```
查看用于 Gitea 的主题文件: `./dist/theme-github.css`
在开发过程中实时构建主题文件
```bash
npm run watch
```
查看用于 Gitea 的主题文件: `dist/theme-github.css`
## 贡献
欢迎提交 Issue 或 Pull Request
欢迎提交 Issue 或 Pull Request

34
build.js Normal file
View File

@@ -0,0 +1,34 @@
import * as process from "node:process";
import * as fs from "node:fs";
import * as sass from "sass";
import * as yaml from "js-yaml";
async function compile(inputFile) {
return (await sass.compileAsync(inputFile, { sourceMap: false, style: "compressed" })).css;
}
async function generateTheme(themePath) {
try {
const fileContent = fs.readFileSync(themePath);
const data = yaml.load(fileContent);
console.log(data.gitea.version);
fs.mkdirSync("dist", { recursive: true });
const styles = await compile("src/styles/styles.scss");
for (const theme of data.gitea.themes) {
const inputFile = `src/themes/${theme}.scss`;
const outputFile = `dist/theme-github-${theme}.css`;
const result = await compile(inputFile);
fs.writeFileSync(outputFile, `${styles}${result}`);
}
} catch (error) {
let e = error;
if (error instanceof Error) {
e = error.message;
}
console.error("Build failed:", e);
process.exit(1);
}
}
generateTheme("theme.yml");

43
build.ts Executable file
View File

@@ -0,0 +1,43 @@
#!/usr/bin/env -S deno run -A --allow-scripts -q
import * as sass from "npm:sass";
import * as yaml from "npm:js-yaml";
interface Gitea {
version: string;
themes: [string];
}
interface ThemeInfo {
gitea: Gitea;
}
async function compile(inputFile: string) {
return (await sass.compileAsync(inputFile, { sourceMap: false, style: "compressed" })).css;
}
async function generateTheme(themePath: string) {
try {
const fileContent = await Deno.readTextFile(themePath);
const data: ThemeInfo = yaml.load(fileContent);
console.log(data.gitea.version);
await Deno.mkdir("dist", { recursive: true });
const styles = await compile("src/styles/styles.scss");
for (const theme of data.gitea.themes) {
const inputFile = `src/themes/${theme}.scss`;
const outputFile = `dist/theme-github-${theme}.css`;
const result = await compile(inputFile);
await Deno.writeTextFile(outputFile, `${styles}${result}`);
}
} catch (error) {
let e = error;
if (error instanceof Error) {
e = error.message;
}
console.error("Build failed:", e);
Deno.exit(1);
}
}
generateTheme("theme.yml");

11
deno.json Normal file
View File

@@ -0,0 +1,11 @@
{
"nodeModulesDir": "auto",
"fmt": {
"options": {
"lineWidth": 120
}
},
"tasks": {
"build": "deno -A --allow-scripts build.ts"
}
}

View File

@@ -1,24 +1,10 @@
{
"name": "gitea-github-theme",
"version": "1.0.0",
"description": "尽量保持与 GitHub Dark 相同样式的 Gitea 主题",
"type": "module",
"scripts": {
"export": "sass src/theme-github.scss:dist/theme-github.css --no-source-map",
"build": "npm run export -- --style=compressed",
"watch": "npm run export -- --watch"
"build": "node build.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/lutinglt/gitea-github-theme.git"
},
"keywords": [],
"author": "",
"type": "commonjs",
"bugs": {
"url": "https://github.com/lutinglt/gitea-github-theme/issues"
},
"homepage": "https://github.com/lutinglt/gitea-github-theme#readme",
"devDependencies": {
"js-yaml": "^4.1.0",
"sass": "^1.83.0"
}
}

View File

@@ -0,0 +1,9 @@
// Made by Luting ^-^
@use "components/dashboard"; // 首页
@use "components/repo"; // 仓库
@use "components/issue"; // 工单&拉取请求
@use "components/setting"; // 设置
@use "components/release"; // 发布
@use "components/actions"; // 操作
@use "components/heatmap"; // 热力图
@use "components/diff"; // 对比

View File

@@ -6,22 +6,18 @@
min-height: calc(-104px + 100vh);
&:before {
content: 'Actions';
content: "Actions";
display: block;
font-size: 20px;
font-weight: 600;
margin-top: 6px;
margin-bottom: 24px;
}
.item {
font-weight: 400;
}
}
.twelve.wide {
&:before {
content: 'Workflow Runs';
content: "Workflow Runs";
display: block;
font-size: 20px;
margin-top: 6px;
@@ -78,10 +74,6 @@
border-radius: var(--border-radius);
margin-left: 32px;
}
.run-list-item-right {
width: 80px;
}
}
}
}
@@ -128,7 +120,7 @@
}
.action-commit-summary {
margin-left: 28+14px;
margin-left: 28 + 14px;
}
}
}
@@ -154,7 +146,7 @@
border-top: 1px solid #2f353d;
&:before {
content: 'Jobs';
content: "Jobs";
color: #9198a1;
font-size: 12px;
font-weight: 600;
@@ -187,7 +179,7 @@
overflow: visible;
background: #1f6feb;
border-radius: 0.375rem;
content: '';
content: "";
height: 24px;
left: calc(0.5rem * -1);
position: absolute;

View File

@@ -86,7 +86,7 @@
.dropdown.item,
.link.item,
a.item {
color: var(--color-text);
color: #f0f6fc;
svg {
color: #9198a1;

View File

@@ -31,7 +31,6 @@
.item,
.item > summary {
font-size: 1.1rem;
font-weight: 500;
background: unset;
padding: 6px 8px;
color: var(--color-white) !important;
@@ -41,6 +40,11 @@
background: unset;
}
.active.item,
.active.item > summary {
font-weight: 600;
}
.active.item:after {
@extend %active-item-after-style;
}
@@ -48,6 +52,7 @@
details {
&:has(.active.item) {
> summary {
font-weight: 600;
background: #161a21;
&:hover {
@@ -55,6 +60,10 @@
}
}
.active.item {
font-weight: 400;
}
&[open] {
> summary {
background: unset;

13
src/styles/public.scss Normal file
View File

@@ -0,0 +1,13 @@
// Made by Luting ^-^
@use "public/chroma"; // 代码高亮
@use "public/codemirror";
@use "public/emoji";
@use "public/transition"; // 添加过渡动画
@use "public/modal"; // 弹窗
@use "public/input"; // 输入框
@use "public/button"; // 按钮
@use "public/label"; // 标签
@use "public/dropdown"; // 下拉菜单
@use "public/svg"; // svg
@use "public/fontcolor"; // 字体颜色
@use "public/radius"; // 圆角

View File

@@ -1,4 +1,4 @@
// Made by Luting ^-^
// Made by Rainnny <3
.chroma {
background-color: var(--color-code-bg);

View File

@@ -1,4 +1,4 @@
// Made by Luting ^-^
// Made by Rainnny <3
.CodeMirror.cm-s-default,
.CodeMirror.cm-s-paper {
.cm-property {

3
src/styles/styles.scss Normal file
View File

@@ -0,0 +1,3 @@
/* Made by Luting ^-^ */
@use "public";
@use "components";

View File

@@ -1,22 +0,0 @@
/* Made by Luting ^-^ */
@use 'chroma';
@use 'codemirror';
@use 'root';
@use 'emoji';
@use 'transition'; // 添加过渡动画
@use 'modal'; // 弹窗
@use 'input'; // 输入框
@use 'button'; // 按钮
@use 'label'; // 标签
@use 'dropdown'; // 下拉菜单
@use 'dashboard'; // 首页
@use 'repo'; // 仓库
@use 'issue'; // 工单&拉取请求
@use 'setting'; // 设置
@use 'release'; // 发布
@use 'actions'; // 操作
@use 'svg'; // svg
@use 'fontcolor'; // 字体颜色
@use 'radius'; // 圆角
@use 'heatmap'; // 热力图
@use 'diff'; // 对比

3
src/themes/dark.scss Normal file
View File

@@ -0,0 +1,3 @@
// Made by Luting ^-^
@use "dark/github-dark.css"; // GitHub 变量(仅主题内部使用的变量)
@use "dark/gitea-dark.css"; // Gitea 变量(元素默认使用的变量)

View File

@@ -1,4 +1,4 @@
// Made by Luting ^-^
/* Made by Luting ^-^ */
:root {
--is-dark-theme: true;
--border-radius: 6px;
@@ -226,4 +226,4 @@
--color-active-line: #534d1b;
accent-color: var(--color-accent);
color-scheme: dark;
}
}

View File

@@ -0,0 +1 @@
/* Made by Luting ^-^ */

3
theme.yml Normal file
View File

@@ -0,0 +1,3 @@
gitea:
version: 1.23.3
themes: [dark]