Add gitea color theme.

This commit is contained in:
lutinglt committed 2026-05-17 13:44:37 +08:00
1 parent ee64e89442
commit 3242a65db2
21 files changed
+922 -35

No files matched your search

+3
View File
@@ -32,6 +32,9 @@ jobs:
tar -zcf dist/theme-github-extra-pink.tar.gz --remove-files \
dist/theme-github-pink-auto.css dist/theme-github-pink-light.css dist/theme-github-pink-dark.css dist/theme-github-pink-soft-dark.css
tar -zcf dist/theme-github-extra-gitea.tar.gz --remove-files \
dist/theme-github-gitea-auto.css dist/theme-github-gitea-light.css dist/theme-github-gitea-dark.css
tar -zcf dist/theme-github-templates.tar.gz templates
tar -zcf dist/theme-github-translations.tar.gz --remove-files dist/options
TAG="v$(npm run -s version)"
+4
View File
@@ -1,3 +1,7 @@
### ✨ Feature
- Add gitea color theme.
### 🌈 Style
- Add a click displacement animation similar to shadcn style to the button.
+1 -1
View File
@@ -19,7 +19,7 @@
import { saturate } from "polished";
import { scaleColorLight } from "src/functions";
import { type GitHubColor } from "./github";
import type { GitHubColor } from "./github";
export type DisplayColor = {
num0: string;
+163
View File
@@ -0,0 +1,163 @@
/*!
* Copyright (c) https://github.com/lutinglt
*
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { opacify, saturate } from "polished";
import type { ThemeVars } from "src/core";
import { scaleColorLight } from "src/functions";
import type { Ansi, Console, Diff, GitHub, Message, Named, Other, Primary, Secondary } from "src/types";
import { themeVars } from "src/types";
export type GiteaColor = {
isDarkTheme: boolean;
primary: Primary;
secondary: Secondary;
named: Named;
message: Message;
ansi: Ansi;
console: Console;
diff: Diff;
other: Other;
};
export function gitea2ThemeVars(giteaColor: GiteaColor): ThemeVars {
const github: GitHub = {
avatar: { bgColor: giteaColor.other.body, borderColor: giteaColor.other.light.border },
fgColor: {
accent: giteaColor.isDarkTheme ? giteaColor.primary.dark.num2 : giteaColor.primary.self,
success: giteaColor.named.green.self,
done: giteaColor.named.purple.self,
onEmphasis: giteaColor.named.white,
},
bgColor: {
accent: {
emphasis: giteaColor.primary.self,
muted: giteaColor.isDarkTheme ? giteaColor.primary.light.num5 : giteaColor.primary.light.num6,
},
success: { emphasis: giteaColor.isDarkTheme ? giteaColor.named.green.dark.num1 : giteaColor.named.green.light },
attention: {
emphasis: giteaColor.isDarkTheme ? giteaColor.named.yellow.dark.num1 : giteaColor.named.yellow.self,
},
danger: { emphasis: giteaColor.named.red.light },
done: { emphasis: giteaColor.isDarkTheme ? giteaColor.named.purple.dark.num1 : giteaColor.named.purple.self },
neutral: { emphasis: giteaColor.secondary.self },
},
borderColor: {
accent: { emphasis: giteaColor.isDarkTheme ? giteaColor.primary.light.num1 : giteaColor.primary.dark.num1 },
attention: {
emphasis: giteaColor.isDarkTheme ? giteaColor.named.yellow.dark.num1 : giteaColor.named.yellow.self,
},
success: { emphasis: giteaColor.isDarkTheme ? giteaColor.named.green.dark.num1 : giteaColor.named.green.light },
done: { emphasis: giteaColor.isDarkTheme ? giteaColor.named.purple.dark.num1 : giteaColor.named.purple.self },
emphasis: giteaColor.other.light.border,
},
button: {
default: { bgColor: { active: giteaColor.other.active } },
primary: {
fgColor: {
accent: saturate(0.1, scaleColorLight(giteaColor.primary.self, giteaColor.isDarkTheme ? 10 : -10)),
rest: giteaColor.named.white,
},
bgColor: giteaColor.isDarkTheme
? {
rest: giteaColor.primary.self,
hover: giteaColor.primary.light.num1,
active: giteaColor.primary.light.num2,
}
: {
rest: giteaColor.primary.self,
hover: giteaColor.primary.dark.num1,
active: giteaColor.primary.dark.num2,
},
borderColor: { rest: giteaColor.secondary.alpha.num20, hover: giteaColor.secondary.alpha.num20 },
},
danger: {
fgColor: { rest: giteaColor.named.red.light, hover: giteaColor.named.white },
bgColor: {
rest: giteaColor.other.button,
hover: giteaColor.named.red.self,
active: giteaColor.named.red.dark.num1,
},
borderColor: { hover: giteaColor.secondary.alpha.num20 },
},
star: { iconColor: giteaColor.named.yellow.self },
invisible: { iconColor: { rest: giteaColor.other.text.self } },
},
control: {
bgColor: { rest: giteaColor.other.timeline },
transparent: {
bgColor: { hover: giteaColor.other.hover.self, active: giteaColor.other.active },
},
danger: {
bgColor: {
active: opacify(0.3, giteaColor.named.red.badge.bg),
},
},
},
// 对调颜色映射, 倾向于个人标准(激活项颜色和菜单色一致)
controlTrack: { bgColor: { rest: giteaColor.other.active } },
controlKnob: { bgColor: { rest: giteaColor.other.menu } },
shadow: {
floating: {
small: `0px 0px 0px 1px ${themeVars.color.light.border}, 0px 6px 12px -3px ${themeVars.color.shadow.self}, 0px 6px 18px 0px ${themeVars.color.shadow.self};`,
},
inset: `inset 0px 1px 0px 0px ${giteaColor.other.shadow.self}`,
resting: {
small: `0px 1px 1px 0px ${giteaColor.other.shadow.self}, 0px 1px 3px 0px ${giteaColor.other.shadow.self};`,
// 此阴影用于工作流的流程图的节点悬浮效果, 该效果在 Gitea 中通过 svg, g 的 filter 实现, 而非 box-shadow
medium: `drop-shadow(0 1px 1px ${giteaColor.other.shadow.self}) drop-shadow(0 3px 6px ${giteaColor.other.shadow.opaque})`,
},
},
underlineNav: { borderColor: { active: giteaColor.other.text.dark } },
contribution: {
default: {
bgColor: {
num0: giteaColor.secondary.alpha.num60,
num1: giteaColor.primary.light.num4,
num2: giteaColor.primary.light.num2,
num3: giteaColor.primary.self,
num4: giteaColor.primary.dark.num2,
num5: giteaColor.primary.dark.num4,
},
borderColor: {
num0: giteaColor.secondary.alpha.num10,
num1: themeVars.github.contribution.default.borderColor.num0,
num2: themeVars.github.contribution.default.borderColor.num0,
num3: themeVars.github.contribution.default.borderColor.num0,
num4: themeVars.github.contribution.default.borderColor.num0,
num5: themeVars.github.contribution.default.borderColor.num0,
},
},
},
workflowCardBg: giteaColor.other.button,
};
return {
isDarkTheme: giteaColor.isDarkTheme,
color: {
...giteaColor.other,
...giteaColor.message,
...giteaColor.named,
primary: giteaColor.primary,
secondary: giteaColor.secondary,
ansi: giteaColor.ansi,
console: giteaColor.console,
diff: giteaColor.diff,
},
github: github,
};
}
+3 -3
View File
@@ -20,8 +20,8 @@
import { saturate } from "polished";
import type { Console, Diff, Other } from "src";
import { scaleColorLight } from "src/functions";
import { themeVars, type Github } from "src/types";
import { type ThemeColor } from "./color";
import { themeVars, type GitHub } from "src/types";
import type { ThemeColor } from "./theme";
export type GitHubColor = {
isDarkTheme: boolean;
@@ -200,7 +200,7 @@ export function github2ThemeColor(githubColor: GitHubColor): ThemeColor {
workflowEdgeHover: githubColor.bgColor.accent.emphasis,
};
const github: Github = {
const github: GitHub = {
avatar: { bgColor: githubColor.avatar.bgColor, borderColor: githubColor.avatar.borderColor },
fgColor: {
accent: githubColor.fgColor.accent,
File renamed without changes.
+24
View File
@@ -0,0 +1,24 @@
/*!
* Copyright (c) https://github.com/lutinglt
*
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export { display2GitHubColor, type DisplayColor } from "./display";
export { gitea2ThemeVars, type GiteaColor } from "./gitea";
export { github2ThemeColor, type GitHubColor } from "./github";
export { githubSyntax2CodeMirror, prettylights2Chroma, type GitHubSyntax } from "./githubSyntax";
export { theme2ThemeVars, type ThemeColor } from "./theme";
+4 -4
View File
@@ -18,10 +18,10 @@
*/
import { rgba, saturate } from "polished";
import type { ThemeVars } from "src/core";
import { scaleColorLight } from "src/functions";
import type { Ansi, Console, Diff, Github, Message, Named, Other, Primary, Secondary } from "src/types";
import type { Ansi, Console, Diff, GitHub, Message, Named, Other, Primary, Secondary } from "src/types";
import { themeVars } from "src/types";
import type { GiteaColor } from "./theme";
export type ThemeColor = {
/** 用于标识当前是否为暗色主题: `true` 暗色 `false` 亮色 */
@@ -74,10 +74,10 @@ export type ThemeColor = {
/** 其他 */
other: Other;
/** 仅适用于本主题的全局变量, 取自 Github */
github: Github;
github: GitHub;
};
export function theme2GiteaColor(themeColor: ThemeColor): GiteaColor {
export function theme2ThemeVars(themeColor: ThemeColor): ThemeVars {
const brightDir = themeColor.isDarkTheme ? -1 : 1;
const primary: Primary = {
+1 -5
View File
@@ -17,10 +17,6 @@
* limitations under the License.
*/
export type { ThemeColor } from "./color";
export { display2GitHubColor, type DisplayColor } from "./display";
export { github2ThemeColor, type GitHubColor } from "./github";
export type { GitHubSyntax } from "./githubSyntax";
export { createTheme, defineTheme } from "./theme";
export type { GiteaColor, Theme } from "./theme";
export type { Theme, ThemeVars } from "./theme";
export type { CSSVarFunction, MapLeafNodes } from "./types";
+6 -8
View File
@@ -19,15 +19,13 @@
import { createGlobalTheme, globalKeyframes, globalStyle } from "@vanilla-extract/css";
import { github2ThemeColor, selectors } from "src";
import type { GiteaColor, GitHubColor, GitHubSyntax, ThemeColor } from "src/color";
import { gitea2ThemeVars, githubSyntax2CodeMirror, prettylights2Chroma, theme2ThemeVars } from "src/color";
import { createChroma, createCodeMirror } from "src/styles";
import { otherThemeVars, syntaxVars, themeVars, type Syntax } from "src/types";
import { theme2GiteaColor, type ThemeColor } from "./color";
import type { GitHubColor } from "./github";
import { githubSyntax2CodeMirror, prettylights2Chroma, type GitHubSyntax } from "./githubSyntax";
import type { MapLeafNodes } from "./types";
type themeVarsColor = MapLeafNodes<typeof themeVars, string>;
export type GiteaColor = { isDarkTheme: boolean } & themeVarsColor;
export type ThemeVars = { isDarkTheme: boolean } & MapLeafNodes<typeof themeVars, string>;
export type ThemeColors =
| { colorType: "github"; themeColor: GitHubColor; syntaxColor: GitHubSyntax }
| { colorType: "gitea"; themeColor: GiteaColor; syntaxColor: Syntax }
@@ -85,10 +83,10 @@ declare const __THEME_VERSION__: string;
export function createTheme(theme: Theme): void {
const { isDarkTheme, ...themeVarsColor } =
theme.colorType === "github"
? theme2GiteaColor(github2ThemeColor(theme.themeColor))
? theme2ThemeVars(github2ThemeColor(theme.themeColor))
: theme.colorType === "theme"
? theme2GiteaColor(theme.themeColor)
: theme.themeColor;
? theme2ThemeVars(theme.themeColor)
: gitea2ThemeVars(theme.themeColor);
// 注入主题标识和版本号
createGlobalTheme(selectors.root, {
+4 -3
View File
@@ -19,11 +19,12 @@
import selectors from "./selectors";
export { createTheme, defineTheme, display2GitHubColor, github2ThemeColor } from "./core";
export type { DisplayColor, GitHubColor, GitHubSyntax, ThemeColor } from "./core";
export { display2GitHubColor, github2ThemeColor } from "./color";
export type { DisplayColor, GitHubColor, GitHubSyntax, GiteaColor, ThemeColor } from "./color";
export { createTheme, defineTheme } from "./core";
export { extractVarName, scaleColorLight } from "./functions";
export { createThemeMetaInfo } from "./styles";
export { chromaVars, customThemeVars, otherThemeVars, syntaxVars, themeVars } from "./types";
export type { Ansi, Chroma, Console, Diff, Github, Message, Named, Other, Primary, Secondary } from "./types";
export type { Ansi, Chroma, Console, Diff, GitHub, Message, Named, Other, Primary, Secondary, Syntax } from "./types";
export { defineThemeConfig } from "./vite-plugin";
export { selectors };
+2 -2
View File
@@ -42,7 +42,7 @@ export type Console = MapLeafNodes<typeof color.console, string>;
export type Diff = MapLeafNodes<typeof color.diff, string>;
/** 其他颜色 */
export type Other = MapLeafNodes<typeof color.other, string>;
/** 仅限本主题的 Github 颜色 */
export type Github = MapLeafNodes<typeof color.github, string>;
/** 仅限本主题的 GitHub 颜色 */
export type GitHub = MapLeafNodes<typeof color.github, string>;
export { chromaVars, codeMirrorVars, customThemeVars, otherThemeVars, syntaxVars, themeVars } from "./vars";
+4
View File
@@ -115,6 +115,10 @@ export const actions = css`
}
}
}
/* 分页按钮, GitHub Gitea 修正, 不影响其他配色 */
.center.page.buttons {
background: ${themeVars.color.body};
}
}
}
}
+3 -3
View File
@@ -26,7 +26,7 @@ export const dashboard = css`
/* 仪表板切换控制用户按钮 */
.ui.dropdown .menu.context-user-switch .scrolling.menu {
animation: none; /* 去掉嵌套菜单导致的多余动画 */
box-shadow: 0px 0px 0px 1px ${themeVars.color.light.border} !important;
box-shadow: 0px 0px 0px 1px ${themeVars.color.secondary.self} !important;
}
}
/* 首页仪表板, 避免选中管理员后台的维护管理面板 */
@@ -72,7 +72,7 @@ export const dashboard = css`
background: ${themeVars.github.controlKnob.bgColor.rest};
border-radius: 12px;
box-shadow:
0px 0px 0px 1px ${themeVars.color.light.border},
0px 0px 0px 1px ${themeVars.color.secondary.self},
${themeVars.github.shadow.resting.small};
transition: transform 200ms cubic-bezier(0.33, 1, 0.68, 1);
z-index: 1;
@@ -99,7 +99,7 @@ export const dashboard = css`
background-color: ${themeVars.color.menu};
border: unset !important;
box-shadow:
0px 0px 0px 1px ${themeVars.color.light.border},
0px 0px 0px 1px ${themeVars.color.secondary.self},
${themeVars.github.shadow.resting.small};
&.repos-search {
border-top-left-radius: 12px;
@@ -38,6 +38,7 @@ export const issueSidebar = css`
gap: 24px;
/* 侧边栏 */
.issue-content-right {
background-color: ${themeVars.color.body};
border: 0;
font-size: 12px;
padding: 0;
+3 -3
View File
@@ -34,19 +34,19 @@ export const smallCompactMenu = css`
.page-content.repository.labels .issue-navbar {
.ui.compact.small.menu.small-menu-items {
background: ${themeVars.github.controlTrack.bgColor.rest} !important;
border: 1px solid ${themeVars.color.light.border};
border: 1px solid ${themeVars.color.secondary.self};
font-size: 14px;
gap: 4px;
height: 32px;
min-height: 32px !important;
> .item {
background: unset !important;
border: 1px solid ${themeVars.github.controlTrack.bgColor.rest};
border: 1px solid #0000;
border-radius: ${otherThemeVars.border.radius};
padding: 6px 12px !important;
&.active {
background: ${themeVars.github.controlKnob.bgColor.rest} !important;
border-color: ${themeVars.color.light.border};
border-color: ${themeVars.color.secondary.self};
font-weight: 600;
margin-top: -1px;
margin-bottom: -1px;
+3 -3
View File
@@ -27,10 +27,10 @@ export const commitSignBadge = css`
margin: unset;
height: 26px;
margin: 0 4px;
&:hover {
background-color: unset !important;
}
&.commit-is-signed {
&:hover {
background-color: unset !important;
}
span.ui.label.commit-sign-badge.commit-is-signed {
margin: unset;
}
+7
View File
@@ -69,4 +69,11 @@ export default defineThemeConfig([
"soft-dark": { theme: themes.github.pink.softDark },
},
},
{
themeSeriesName: "gitea",
themes: {
dark: { theme: themes.gitea.dark },
light: { theme: themes.gitea.light },
},
},
]);
+340
View File
@@ -0,0 +1,340 @@
/*!
* Copyright (c) https://github.com/lutinglt
*
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @author lutinglt
*/
import type { Ansi, Console, Diff, GiteaColor, Message, Named, Other, Primary, Secondary, Syntax } from "src";
import { defineTheme, themeVars } from "src";
const primary: Primary = {
self: "#4183c4",
contrast: "#ffffff",
dark: {
num1: "#548fca",
num2: "#679cd0",
num3: "#7aa8d6",
num4: "#8db5dc",
num5: "#b3cde7",
num6: "#d9e6f3",
num7: "#f4f8fb",
},
light: {
num1: "#3876b3",
num2: "#31699f",
num3: "#2b5c8b",
num4: "#254f77",
num5: "#193450",
num6: "#0c1a28",
num7: "#04080c",
},
alpha: {
num10: "#4183c419",
num20: "#4183c433",
num30: "#4183c44b",
num40: "#4183c466",
num50: "#4183c480",
num60: "#4183c499",
num70: "#4183c4b3",
num80: "#4183c4cc",
num90: "#4183c4e1",
},
hover: themeVars.color.primary.light.num1,
active: themeVars.color.primary.light.num2,
};
const secondary: Secondary = {
self: "#3f4248",
dark: {
num1: "#46494f",
num2: "#4f5259",
num3: "#5e626a",
num4: "#6f747d",
num5: "#7d828c",
num6: "#8b8f98",
num7: "#999da4",
num8: "#a8abb1",
num9: "#aeb1b8",
num10: "#bbbec3",
num11: "#c8cacf",
num12: "#d2d4d7",
num13: "#d5d6d9",
},
light: {
num1: "#35373c",
num2: "#2c2e32",
num3: "#1f2124",
num4: "#191a1c",
},
alpha: {
num10: "#3f424819",
num20: "#3f424833",
num30: "#3f42484b",
num40: "#3f424866",
num50: "#3f424880",
num60: "#3f424899",
num70: "#3f4248b3",
num80: "#3f4248cc",
num90: "#3f4248e1",
},
button: themeVars.color.secondary.dark.num4,
hover: themeVars.color.secondary.dark.num3,
active: themeVars.color.secondary.dark.num2,
};
const console: Console = {
fg: {
self: "#f8f8f8",
subtle: "#c1c3c8",
},
bg: "#191a1c",
border: "#313338",
activeBg: "#313338",
hoverBg: "#2a2c30",
menu: {
bg: "#292b2e",
border: "#46494f",
},
link: "#969aa1",
};
const named: Named = {
red: {
self: "#cc4848",
light: "#d15a5a",
dark: { num1: "#c23636", num2: "#ad3030" },
badge: { self: "#db2828", bg: "#db28281a", hover: { bg: "#db28284d" } },
},
orange: {
self: "#cc580c",
light: "#f6a066",
dark: { num1: "#f38236", num2: "#f16e17" },
badge: { self: "#f2711c", bg: "#f2711c1a", hover: { bg: "#f2711c4d" } },
},
yellow: {
self: "#cc9903",
light: "#eaaf03",
dark: { num1: "#b88a03", num2: "#a37a02" },
badge: { self: "#fbbd08", bg: "#fbbd081a", hover: { bg: "#fbbd084d" } },
},
olive: { self: "#91a313", light: "#abc016", dark: { num1: "#839311", num2: "#74820f" } },
green: {
self: "#87ab63",
light: "#93b373",
dark: { num1: "#7a9e55", num2: "#6c8c4c" },
badge: { self: "#21ba45", bg: "#21ba451a", hover: { bg: "#21ba454d" } },
},
teal: { self: "#00918a", light: "#00b6ad", dark: { num1: "#00837c", num2: "#00746e" } },
blue: { self: "#3a8ac6", light: "#4e96cc", dark: { num1: "#347cb3", num2: "#2e6e9f" } },
violet: { self: "#906ae1", light: "#9b79e4", dark: { num1: "#7b4edb", num2: "#6733d6" } },
purple: { self: "#b259d0", light: "#ba6ad5", dark: { num1: "#a742c9", num2: "#9834b9" } },
pink: { self: "#d22e8b", light: "#d74397", dark: { num1: "#be297d", num2: "#a9246f" } },
brown: { self: "#a47252", light: "#b08061", dark: { num1: "#94674a", num2: "#835b42" } },
black: { self: "#202225", light: "#45484e", dark: { num1: "#2e3033", num2: "#292b2e" } },
grey: { self: "#3d3f44", light: "#898d96" },
gold: "#b1983b",
white: "#ffffff",
};
const ansi: Ansi = {
black: "#202225",
red: "#cc4848",
green: "#87ab63",
yellow: "#cc9903",
blue: "#3a8ac6",
magenta: "#d22e8b",
cyan: "#00918a",
white: themeVars.color.console.fg.subtle,
bright: {
black: "#45484e",
red: "#d15a5a",
green: "#93b373",
yellow: "#eaaf03",
blue: "#4e96cc",
magenta: "#d74397",
cyan: "#00b6ad",
white: themeVars.color.console.fg.self,
},
};
const diff: Diff = {
added: {
fg: "#87ab63",
linenum: { bg: "#274227" },
row: { bg: "#203224", border: "#314a37" },
word: { bg: "#3c653c" },
},
moved: {
row: { bg: "#818044", border: "#bcca6f" },
},
removed: {
fg: "#cc4848",
linenum: { bg: "#482121" },
row: { bg: "#301e1e", border: "#634343" },
word: { bg: "#6f3333" },
},
inactive: "#25272a",
};
const message: Message = {
error: {
bg: { self: "#322226", active: "#49262a", hover: "#3c2427" },
border: "#763232",
text: themeVars.color.text.self,
},
success: {
bg: "#1c3329",
border: "#225633",
text: themeVars.color.text.self,
},
warning: {
bg: "#342e1f",
border: "#5f481a",
text: themeVars.color.text.self,
},
info: {
bg: "#1b283a",
border: "#254a7e",
text: themeVars.color.text.self,
},
};
const other: Other = {
logo: "#609926",
body: "#1e1f20",
footer: themeVars.color.nav.bg,
timeline: "#383b40",
box: {
header: "#1b1c1e",
body: { self: "#161718", highlight: "#202124" },
},
text: {
self: "#d2d4d8",
light: { self: "#c0c2c7", num1: "#aaadb4", num2: "#969aa1", num3: "#80858f" },
dark: "#f8f8f8",
},
input: {
text: themeVars.color.text.dark,
background: "#191a1c",
toggleBackground: "#323438",
border: themeVars.color.secondary.dark.num1,
},
light: { self: "#0b0b0c28", border: "#f3f3f428" },
hover: { self: "#f3f3f419", opaque: "#232528" },
active: "#f3f3f424",
menu: "#191a1c",
card: "#191a1c",
markup: {
tableRow: "#f3f3f40f",
code: { block: "#f3f3f412", inline: "#f3f3f428" },
},
button: "#191a1c",
codeBg: "#161718",
shadow: { self: "#0b0b0c58", opaque: "#0b0b0c" },
secondaryBg: "#2e3033",
expandButton: "#333539",
placeholderText: themeVars.color.text.light.num3,
editor: {
lineHighlight: themeVars.color.secondary.alpha.num40,
selection: themeVars.color.primary.alpha.num50,
},
projectColumnBg: themeVars.color.secondary.light.num2,
caret: themeVars.color.text.self,
reaction: {
bg: "#f3f3f412",
hoverBg: themeVars.color.primary.light.num4,
activeBg: themeVars.color.primary.light.num5,
},
tooltip: { text: "#fafafa", bg: "#0b0b0cf0" },
nav: {
bg: "#18191b",
hoverBg: themeVars.color.secondary.light.num1,
text: themeVars.color.text.self,
},
secondaryNavBg: "#1a1b1e",
label: {
text: themeVars.color.text.self,
bg: "#7a7f8a4b",
hoverBg: "#7a7f8aa0",
activeBg: "#7a7f8aff",
},
accent: themeVars.color.primary.light.num1,
smallAccent: themeVars.color.primary.light.num5,
highlight: { fg: "#87651e", bg: "#443a27" },
overlayBackdrop: "#080808c0",
danger: themeVars.color.red.self,
transparency: { grid: { light: "#2a2a2a", dark: "#1a1a1a" } },
workflowEdgeHover: "#666a73",
};
export const giteaDarkColor: GiteaColor = {
isDarkTheme: true,
primary,
secondary,
named,
message,
ansi,
console,
diff,
other,
};
export const giteaDarkSyntax: Syntax = {
keyword: "#ff8854",
bool: "#25bbc9",
control: "#dd9e17",
name: "#c7a618",
type: "#eb8cb3",
number: "#63b2dd",
operator: "#ff8854",
regexp: "#b89de4",
string: "#95b62a",
comment: "#8898b0",
invalid: "#ff8686",
link: themeVars.color.primary.self,
tag: "#ff8854",
attribute: "#c792ff",
property: "#55afff",
variable: "#e29b33",
stringSpecial: "#dd9e17",
escape: "#c7a618",
entity: "#c792ff",
preproc: "#4cbe7a",
preprocFile: "#63b2dd",
decorator: "#4cbe7a",
namespace: "#c9d1d9",
namePseudo: "#c792ff",
commentSpecial: "#b89de4",
text: "#c9d1d9",
textAlt: "#b9bcc7",
punctuation: "#d2d4db",
whitespace: "#7f8699",
diffFg: "#ffffff",
deletedBg: "#5f3737",
insertedBg: "#3a523a",
emph: "#d1a242",
strong: "#e29b33",
heading: "#dd9e17",
subheading: "#95b62a",
output: "#8898b0",
prompt: "#e29b33",
traceback: "#ff8686",
matchingBracketBg: "#00918a48",
nonmatchingBracketBg: "#cc484848",
};
export const giteaDarkTheme = defineTheme({
colorType: "gitea",
themeColor: giteaDarkColor,
syntaxColor: giteaDarkSyntax,
});
+340
View File
@@ -0,0 +1,340 @@
/*!
* Copyright (c) https://github.com/lutinglt
*
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @author lutinglt
*/
import type { Ansi, Console, Diff, GiteaColor, Message, Named, Other, Primary, Secondary, Syntax } from "src";
import { defineTheme, themeVars } from "src";
const primary: Primary = {
self: "#4183c4",
contrast: "#ffffff",
dark: {
num1: "#3876b3",
num2: "#31699f",
num3: "#2b5c8b",
num4: "#254f77",
num5: "#193450",
num6: "#0c1a28",
num7: "#04080c",
},
light: {
num1: "#548fca",
num2: "#679cd0",
num3: "#7aa8d6",
num4: "#8db5dc",
num5: "#b3cde7",
num6: "#d9e6f3",
num7: "#f4f8fb",
},
alpha: {
num10: "#4183c419",
num20: "#4183c433",
num30: "#4183c44b",
num40: "#4183c466",
num50: "#4183c480",
num60: "#4183c499",
num70: "#4183c4b3",
num80: "#4183c4cc",
num90: "#4183c4e1",
},
hover: themeVars.color.primary.dark.num1,
active: themeVars.color.primary.dark.num2,
};
const secondary: Secondary = {
self: "#d0d7de",
dark: {
num1: "#c7ced5",
num2: "#b9c0c7",
num3: "#99a0a7",
num4: "#899097",
num5: "#7a8188",
num6: "#6a7178",
num7: "#5b6269",
num8: "#4b5259",
num9: "#3c434a",
num10: "#2c333a",
num11: "#1d242b",
num12: "#0d141b",
num13: "#00040b",
},
light: {
num1: "#dee5ec",
num2: "#e4ebf2",
num3: "#ebf2f9",
num4: "#f1f8ff",
},
alpha: {
num10: "#d0d7de19",
num20: "#d0d7de33",
num30: "#d0d7de4b",
num40: "#d0d7de66",
num50: "#d0d7de80",
num60: "#d0d7de99",
num70: "#d0d7deb3",
num80: "#d0d7decc",
num90: "#d0d7dee1",
},
button: themeVars.color.secondary.dark.num4,
hover: themeVars.color.secondary.dark.num5,
active: themeVars.color.secondary.dark.num6,
};
const console: Console = {
fg: {
self: "#0d1117",
subtle: "#40474d",
},
bg: "#ffffff",
border: "#d0d7de",
activeBg: "#d0d7de",
hoverBg: "#f1f3f5",
menu: {
bg: "#f8f9fb",
border: "#d0d7de",
},
link: "#5c656d",
};
const named: Named = {
red: {
self: "#db2828",
light: "#e45e5e",
dark: { num1: "#c82121", num2: "#b11e1e" },
badge: { self: "#db2828", bg: "#db28281a", hover: { bg: "#db28284d" } },
},
orange: {
self: "#f2711c",
light: "#f59555",
dark: { num1: "#e6630d", num2: "#cc580c" },
badge: { self: "#f2711c", bg: "#f2711c1a", hover: { bg: "#f2711c4d" } },
},
yellow: {
self: "#fbbd08",
light: "#fcce46",
dark: { num1: "#e5ac04", num2: "#cc9903" },
badge: { self: "#fbbd08", bg: "#fbbd081a", hover: { bg: "#fbbd084d" } },
},
olive: { self: "#b5cc18", light: "#d3e942", dark: { num1: "#a3b816", num2: "#91a313" } },
green: {
self: "#21ba45",
light: "#46de6a",
dark: { num1: "#1ea73e", num2: "#1a9537" },
badge: { self: "#21ba45", bg: "#21ba451a", hover: { bg: "#21ba454d" } },
},
teal: { self: "#00b5ad", light: "#08fff4", dark: { num1: "#00a39c", num2: "#00918a" } },
blue: { self: "#2185d0", light: "#51a5e3", dark: { num1: "#1e78bb", num2: "#1a6aa6" } },
violet: { self: "#6435c9", light: "#8b67d7", dark: { num1: "#5a30b5", num2: "#502aa1" } },
purple: { self: "#a333c8", light: "#bb64d8", dark: { num1: "#932eb4", num2: "#8229a0" } },
pink: { self: "#e03997", light: "#e86bb1", dark: { num1: "#db228a", num2: "#c21e7b" } },
brown: { self: "#a5673f", light: "#c58b66", dark: { num1: "#955d39", num2: "#845232" } },
black: { self: "#1d2328", light: "#4b5b68", dark: { num1: "#2c3339", num2: "#131619" } },
grey: { self: "#697077", light: "#7c838a" },
gold: "#a1882b",
white: "#ffffff",
};
const ansi: Ansi = {
black: "#1e2327",
red: "#cc4848",
green: "#87ab63",
yellow: "#cc9903",
blue: "#3a8ac6",
magenta: "#d22e8b",
cyan: "#00918a",
white: themeVars.color.console.fg.subtle,
bright: {
black: "#46494d",
red: "#d15a5a",
green: "#93b373",
yellow: "#eaaf03",
blue: "#4e96cc",
magenta: "#d74397",
cyan: "#00b6ad",
white: themeVars.color.console.fg.self,
},
};
const diff: Diff = {
added: {
fg: "#21ba45",
linenum: { bg: "#d1f8d9" },
row: { bg: "#e6ffed", border: "#e6ffed" },
word: { bg: "#acf2bd" },
},
moved: {
row: { bg: "#f1f8d1", border: "#d0e27f" },
},
removed: {
fg: "#db2828",
linenum: { bg: "#ffcecb" },
row: { bg: "#ffeef0", border: "#f1c0c0" },
word: { bg: "#fdb8c0" },
},
inactive: "#f0f2f4",
};
const message: Message = {
error: {
bg: { self: "#ffebe9", active: "#ffcecb", hover: "#ffdcd7" },
border: "#ff818266",
text: themeVars.color.text.self,
},
success: {
bg: "#dafbe1",
border: "#4ac26b66",
text: themeVars.color.text.self,
},
warning: {
bg: "#fff8c5",
border: "#d4a72c66",
text: themeVars.color.text.self,
},
info: {
bg: "#ddf4ff",
border: "#54aeff66",
text: themeVars.color.text.self,
},
};
const other: Other = {
logo: "#609926",
body: "#ffffff",
footer: themeVars.color.nav.bg,
timeline: "#d0d7de",
box: {
header: "#f1f3f5",
body: { self: "#ffffff", highlight: "#ecf5fd" },
},
text: {
self: "#181c21",
light: { self: "#30363b", num1: "#40474d", num2: "#5b6167", num3: "#747c84" },
dark: "#01050a",
},
input: {
text: themeVars.color.text.dark,
background: "#fff",
toggleBackground: "#d0d7de",
border: themeVars.color.secondary.dark.num1,
},
light: { self: "#00001706", border: "#0000171d" },
hover: { self: "#00001708", opaque: "#f1f3f5" },
active: "#00001714",
menu: "#f8f9fb",
card: "#f8f9fb",
markup: {
tableRow: "#0030600a",
code: { block: "#00306010", inline: "#00306012" },
},
button: "#f8f9fb",
codeBg: "#fafdff",
shadow: { self: "#00001726", opaque: "#c7ced5" },
secondaryBg: "#f2f5f8",
expandButton: "#cfe8fa",
placeholderText: themeVars.color.text.light.num3,
editor: {
lineHighlight: themeVars.color.secondary.alpha.num30,
selection: themeVars.color.primary.alpha.num30,
},
projectColumnBg: themeVars.color.secondary.light.num4,
caret: themeVars.color.text.dark,
reaction: {
bg: "#0000170a",
hoverBg: themeVars.color.primary.light.num5,
activeBg: themeVars.color.primary.light.num6,
},
tooltip: { text: "#fbfdff", bg: "#000017f0" },
nav: {
bg: "#f6f7fa",
hoverBg: themeVars.color.secondary.light.num1,
text: themeVars.color.text.self,
},
secondaryNavBg: "#f9fafb",
label: {
text: themeVars.color.text.self,
bg: "#949da64b",
hoverBg: "#949da6a0",
activeBg: "#949da6ff",
},
accent: themeVars.color.primary.light.num1,
smallAccent: themeVars.color.primary.light.num6,
highlight: { fg: "#eed200", bg: "#f5efc5" },
overlayBackdrop: "#080808c0",
danger: themeVars.color.red.self,
transparency: { grid: { light: "#fafafa", dark: "#e2e2e2" } },
workflowEdgeHover: "#b1b7bd",
};
export const giteaLightColor: GiteaColor = {
isDarkTheme: false,
primary,
secondary,
named,
message,
ansi,
console,
diff,
other,
};
export const giteaLightSyntax: Syntax = {
keyword: "#a73a00",
bool: "#076872",
control: "#7d5700",
name: "#785900",
type: "#ae2368",
number: "#105ead",
operator: "#a73a00",
regexp: "#773dc5",
string: "#456800",
comment: "#506070",
invalid: "#c00000",
link: themeVars.color.primary.self,
tag: "#a73a00",
attribute: "#6f41c5",
property: "#2060a0",
variable: "#944a00",
stringSpecial: "#7d5700",
escape: "#785900",
entity: "#6f41c5",
preproc: "#2d6a4b",
preprocFile: "#105ead",
decorator: "#2d6a4b",
namespace: "#555555",
namePseudo: "#6f41c5",
commentSpecial: "#773dc5",
text: "inherit",
textAlt: "#47525b",
punctuation: "inherit",
whitespace: "#bbbbbb",
diffFg: "#000000",
deletedBg: "#ffdddd",
insertedBg: "#ddffdd",
emph: "#8b5000",
strong: "inherit",
heading: "#7d5700",
subheading: "#456800",
output: "#506070",
prompt: "#944a00",
traceback: "#c00000",
matchingBracketBg: "#00b5ad38",
nonmatchingBracketBg: "#db282838",
};
export const giteaLightTheme = defineTheme({
colorType: "gitea",
themeColor: giteaLightColor,
syntaxColor: giteaLightSyntax,
});
+6
View File
@@ -17,6 +17,8 @@
* limitations under the License.
*/
import { giteaDarkTheme } from "./giteaDark";
import { giteaLightTheme } from "./giteaLight";
import githubDark from "./githubDark";
import githubLight from "./githubLight";
import githubPink from "./githubPink";
@@ -40,4 +42,8 @@ export default {
softDark: githubPink.githubPinkSoftDarkTheme,
},
},
gitea: {
dark: giteaDarkTheme,
light: giteaLightTheme,
},
};