mirror of
https://github.com/lutinglt/gitea-github-theme.git
synced 2025-10-26 13:00:31 +00:00
Compare commits
23 Commits
v1.23.3-20
...
8e1a01e444
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8e1a01e444 | ||
|
|
4365603d56 | ||
|
|
8def32e5b9 | ||
|
|
ba895a3f31 | ||
|
|
04896a3395 | ||
|
|
69e0c063de | ||
|
|
ce462ff305 | ||
|
|
af2c71b607 | ||
|
|
6a17010a5f | ||
|
|
49812f0ee0 | ||
|
|
5bba897e11 | ||
|
|
bed93d8777 | ||
|
|
d83f8e9e10 | ||
|
|
3ab8c04dee | ||
|
|
14d79f4e9d | ||
|
|
d95b59512b | ||
|
|
79a1049090 | ||
|
|
34f72da8b5 | ||
|
|
c0d181278f | ||
|
|
b8d0e43074 | ||
|
|
79f305ee1e | ||
|
|
9acfd21a9d | ||
|
|
a897230f2c |
20
.editorconfig
Normal file
20
.editorconfig
Normal 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
3
.github/release.md
vendored
@@ -2,4 +2,5 @@
|
||||
|
||||
#### 更符合 GitHub 风格
|
||||
|
||||
- Action工作流页面同步
|
||||
- 仓库导航栏文字颜色优化
|
||||
- Action执行时间位置优化
|
||||
18
.github/workflows/release.yml
vendored
18
.github/workflows/release.yml
vendored
@@ -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
1
.gitignore
vendored
@@ -1,3 +1,4 @@
|
||||
dist
|
||||
node_modules
|
||||
deno.lock
|
||||
package-lock.json
|
||||
@@ -1,3 +1,5 @@
|
||||
dist/
|
||||
node_modules/
|
||||
package-lock.json
|
||||
deno.json
|
||||
deno.lock
|
||||
@@ -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
7
CONTRIBUTING.md
Normal file
@@ -0,0 +1,7 @@
|
||||
| 目录 | 说明 |
|
||||
| ----------------- | ---------------------------- |
|
||||
| styles | 元素 GitHub 风格 |
|
||||
| styles/components | 具体页面的元素单独风格 |
|
||||
| styles/public | 适用大部分页面的元素默认风格 |
|
||||
| themes | 颜色主题 |
|
||||
| themes/\<theme> | 具体颜色主题自己的颜色或风格 |
|
||||
31
README.md
31
README.md
@@ -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
34
build.js
Normal 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
43
build.ts
Executable 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
11
deno.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"nodeModulesDir": "auto",
|
||||
"fmt": {
|
||||
"options": {
|
||||
"lineWidth": 120
|
||||
}
|
||||
},
|
||||
"tasks": {
|
||||
"build": "deno -A --allow-scripts build.ts"
|
||||
}
|
||||
}
|
||||
20
package.json
20
package.json
@@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
9
src/styles/components.scss
Normal file
9
src/styles/components.scss
Normal 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"; // 对比
|
||||
@@ -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;
|
||||
@@ -86,7 +86,7 @@
|
||||
.dropdown.item,
|
||||
.link.item,
|
||||
a.item {
|
||||
color: var(--color-text);
|
||||
color: #f0f6fc;
|
||||
|
||||
svg {
|
||||
color: #9198a1;
|
||||
@@ -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
13
src/styles/public.scss
Normal 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"; // 圆角
|
||||
@@ -1,4 +1,4 @@
|
||||
// Made by Luting ^-^
|
||||
// Made by Rainnny <3
|
||||
.chroma {
|
||||
background-color: var(--color-code-bg);
|
||||
|
||||
@@ -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
3
src/styles/styles.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
/* Made by Luting ^-^ */
|
||||
@use "public";
|
||||
@use "components";
|
||||
@@ -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
3
src/themes/dark.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
// Made by Luting ^-^
|
||||
@use "dark/github-dark.css"; // GitHub 变量(仅主题内部使用的变量)
|
||||
@use "dark/gitea-dark.css"; // Gitea 变量(元素默认使用的变量)
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
1
src/themes/dark/github-dark.css
Normal file
1
src/themes/dark/github-dark.css
Normal file
@@ -0,0 +1 @@
|
||||
/* Made by Luting ^-^ */
|
||||
Reference in New Issue
Block a user