remove polished

This commit is contained in:
lutinglt committed 2026-06-06 22:42:49 +08:00
1 parent 148ca6c33a
commit daedc3f5aa
18 files changed
+928 -930

No files matched your search

+2 -2
View File
@@ -312,7 +312,7 @@ theme-github-auto.css:
### Color Scale Calculation
`scaleColorLight()` in [src/functions/scss.ts](src/functions/scss.ts) implements the Sass `color.scale()` algorithm:
`scaleColorLight()` in [src/functions/color.ts](src/functions/color.ts) implements the Sass `color.scale()` algorithm:
```
darken: newL = currentL × (1 + scale/100) [scale < 0]
@@ -416,7 +416,7 @@ outputs static CSS strings.
│ │ ├── display.ts # Display color scale → GitHubColor overrides
│ │ └── catppuccinSyntax.ts # Catppuccin syntax highlighting
│ ├── functions/ # Utility functions
│ │ ├── scss.ts # scaleColorLight (Sass color.scale port)
│ │ ├── color.ts # scaleColorLight (Sass color.scale) + rgba wrapper
│ │ └── var.ts # extractVarName (CSS variable name extraction)
│ ├── types/ # Type definitions and CSS variable contracts
│ │ ├── color/ # Color structure definitions (primary, secondary, named, etc.)
+2 -2
View File
@@ -302,7 +302,7 @@ theme-github-auto.css:
### 颜色缩放计算
[src/functions/scss.ts](src/functions/scss.ts) 中的 `scaleColorLight()` 实现了 Sass `color.scale()` 算法:
[src/functions/color.ts](src/functions/color.ts) 中的 `scaleColorLight()` 实现了 Sass `color.scale()` 算法:
```
变暗: newL = currentL × (1 + scale/100) [scale < 0]
@@ -401,7 +401,7 @@ const baseButton = css`
│ │ ├── display.ts # Display color scale → GitHubColor 覆写
│ │ └── catppuccinSyntax.ts # Catppuccin 语法高亮
│ ├── functions/ # 工具函数
│ │ ├── scss.ts # scaleColorLight(Sass color.scale 移植)
│ │ ├── color.ts # scaleColorLight(Sass color.scale)+ rgba 转换
│ │ └── var.ts # extractVarName(CSS 变量名提取)
│ ├── types/ # 类型定义与 CSS 变量契约
│ │ ├── color/ # 颜色结构定义(primary, secondary, named, 等)
+3 -3
View File
@@ -115,8 +115,8 @@ Please add your author info at the top of the color theme file so Issue reporter
It is recommended to use `defineTheme` with the `ThemeColor` type to define theme colors. The framework will
automatically compute and generate all Gitea CSS variables.
Color calculation functions can be imported from `@lutinglt/gitea-github-theme/core` (`scaleColorLight`), or use the
`polished` library.
Color calculation functions can be imported from `@lutinglt/gitea-github-theme/core` (`scaleColorLight`, `rgba`),
or use the `color2k` library for additional color manipulation.
Example: `themes/my-theme.ts`
@@ -182,7 +182,7 @@ For color reuse patterns, see the colorblind theme implementation in `themes/git
Theme styles use the `css()` template string for development. Strings are processed by LightningCSS and support CSS
nesting syntax. Do not use SCSS functions; for complex processing, use TypeScript libraries such as the bundled
`polished` library.
`color2k` library.
For complex logic, it is recommended to extract it into functions under the `src/functions` directory.
+2 -2
View File
@@ -106,7 +106,7 @@ bun commit
推荐使用 `defineTheme` 配合 `ThemeColor` 类型来定义主题颜色, 框架会自动计算生成所有 Gitea CSS 变量.
颜色计算函数可从 `@lutinglt/gitea-github-theme/core` 导入 `scaleColorLight`, 或使用 `polished` 库.
颜色计算函数可从 `@lutinglt/gitea-github-theme/core` 导入 `scaleColorLight` 和 `rgba`, 或使用 `color2k` 库进行额外颜色操作.
例: `themes/主题名称.ts`
@@ -171,7 +171,7 @@ export default defineTheme({ colorType: "gitea", themeColor: giteaColor, syntaxC
主题样式使用 `css()`
模板字符串开发,字符串经过 LightningCSS 处理, 支持 CSS 嵌套语法。请勿使用 SCSS 函数,如需复杂处理请使用 TypeScript 相关库,比如项目自带的
`polished` 库。
`color2k` 库。
推荐需要复杂处理时,提取逻辑到 `src/functions` 目录下的函数中。
+3 -1
View File
@@ -47,7 +47,6 @@
"globals": "^17.6.0",
"jiti": "^2.6.1",
"lightningcss": "^1.32.0",
"polished": "^4.3.1",
"prettier": "3.8.1",
"prettier-plugin-organize-imports": "^4.3.0",
"style-dictionary": "^5.4.1",
@@ -85,5 +84,8 @@
}
}
]
},
"dependencies": {
"culori": "^4.0.2"
}
}
@@ -18,54 +18,48 @@
*/
import { describe, expect, it } from "vitest";
import { scaleColorLight } from "./scss";
import { scaleColorLight } from "./color";
describe("scaleColorLight", () => {
describe("变暗 (负值)", () => {
it("中等颜色变暗 20%", () => {
const result = scaleColorLight("#808080", -20);
expect(result).toBeTruthy();
// 亮度应该明显低于原始 50%
expect(result).not.toBe("#808080");
expect(result).not.toBe("hsla(0, 0%, 50%, 1)");
});
it("纯红色变暗 50%", () => {
// 红色 #ff0000 在 HSL 中亮度约 50%
const result = scaleColorLight("#ff0000", -50);
// 变暗后应该接近深红色
expect(result).toBeTruthy();
expect(result).not.toBe("#ff0000");
expect(result).not.toBe("hsla(0, 100%, 50%, 1)");
});
it("纯白色变暗 100% 应变为黑色", () => {
// 白色亮度=1,变暗 100% → newLightness = 1 * (1 + (-100/100)) = 0
// polished.hsl 返回短格式 hex,如 #000
const result = scaleColorLight("#ffffff", -100);
expect(result).toMatch(/^#0{3,6}$/); // #000 或 #000000
expect(result).toBe("hsla(0, 0%, 0%, 1)");
});
it("纯白色变暗 50% 应变为灰色", () => {
// 白色亮度=1,变暗 50% → newLightness = 1 * (1 + (-50/100)) = 0.5
expect(scaleColorLight("#ffffff", -50)).toBe("#808080");
expect(scaleColorLight("#ffffff", -50)).toBe("hsla(0, 0%, 50%, 1)");
});
it("纯黑色变暗 50% 仍为黑色 (边界值)", () => {
// 黑色亮度=0,变暗 50% → newLightness = 0 * (1 + (-50/100)) = 0
const result = scaleColorLight("#000000", -50);
expect(result).toMatch(/^#0{3,6}$/); // #000 或 #000000
expect(result).toBe("hsla(0, 0%, 0%, 1)");
});
it("变暗 0% 颜色不变 (语义等价)", () => {
// polished.hsl 可能返回短格式 hex: #4488cc ↔ #48c
const result = scaleColorLight("#4488cc", -0);
expect(["#48c", "#4488cc"]).toContain(result);
expect(result).toMatch(/^hsla\(/);
});
it("极小幅变暗应接近原色", () => {
const result = scaleColorLight("#ff0000", -1);
// 亮度应轻微下降,但仍在红色范围
it("小幅变暗应接近原色", () => {
const result = scaleColorLight("#ff0000", -5);
expect(result).toBeTruthy();
expect(result).not.toBe("#ff0000");
expect(result).not.toBe("hsla(0, 100%, 50%, 1)");
});
});
@@ -73,37 +67,35 @@ describe("scaleColorLight", () => {
it("中等颜色变亮 20%", () => {
const result = scaleColorLight("#808080", 20);
expect(result).toBeTruthy();
expect(result).not.toBe("#808080");
expect(result).not.toBe("hsla(0, 0%, 50%, 1)");
});
it("纯红色变亮 50%", () => {
const result = scaleColorLight("#ff0000", 50);
// 变亮后应该接近浅红色
expect(result).toBeTruthy();
expect(result).not.toBe("#ff0000");
expect(result).not.toBe("hsla(0, 100%, 50%, 1)");
});
it("纯黑色变亮 100% 应变为白色", () => {
// 黑色亮度=0,变亮 100% → newLightness = 0 + (1-0) * (100/100) = 1
const result = scaleColorLight("#000000", 100);
expect(result).toMatch(/^#f{3,6}$/); // #fff 或 #ffffff
expect(result).toBe("hsla(0, 0%, 100%, 1)");
});
it("纯黑色变亮 50% 应变为灰色", () => {
// 黑色亮度=0,变亮 50% → newLightness = 0 + (1-0) * 0.5 = 0.5
expect(scaleColorLight("#000000", 50)).toBe("#808080");
expect(scaleColorLight("#000000", 50)).toBe("hsla(0, 0%, 50%, 1)");
});
it("纯白色变亮 50% 仍为白色 (边界值)", () => {
// 白色亮度=1,变亮 50% → newLightness = 1 + (1-1) * 0.5 = 1
const result = scaleColorLight("#ffffff", 50);
expect(result).toMatch(/^#f{3,6}$/); // #fff 或 #ffffff
expect(result).toBe("hsla(0, 0%, 100%, 1)");
});
it("变亮 0% 颜色不变 (语义等价)", () => {
// polished.hsl 可能返回短格式 hex: #336699 ↔ #369
const result = scaleColorLight("#336699", 0);
expect(["#369", "#336699"]).toContain(result);
expect(result).toMatch(/^hsla\(/);
});
});
@@ -111,7 +103,7 @@ describe("scaleColorLight", () => {
it("支持 3 位 hex 颜色", () => {
const result = scaleColorLight("#f00", -50);
expect(result).toBeTruthy();
expect(result).not.toBe("#f00");
expect(result).not.toBe("hsla(0, 100%, 50%, 1)");
});
it("支持 6 位 hex 颜色", () => {
@@ -120,7 +112,7 @@ describe("scaleColorLight", () => {
});
it("支持 8 位 hex 颜色 (含 alpha)", () => {
// polished 的 parseToHsl 会忽略 alpha
// parseToHsla 的 alpha 通道不影响亮度计算
const result = scaleColorLight("#ff8800cc", -20);
expect(result).toBeTruthy();
});
@@ -129,24 +121,22 @@ describe("scaleColorLight", () => {
describe("极端缩放值", () => {
it("超过 100% 的变亮会被 clamp 到白色", () => {
const result = scaleColorLight("#808080", 200);
// 调整后亮度可能超过 1,被 clamp 到 1 = 白色
expect(result).toMatch(/^#f{3,6}$/); // #fff 或 #ffffff
expect(result).toBe("hsla(0, 0%, 100%, 1)");
});
it("超过 100% 的变暗会被 clamp 到黑色", () => {
const result = scaleColorLight("#808080", -200);
// 调整后亮度可能低于 0,被 clamp 到 0 = 黑色
expect(result).toMatch(/^#0{3,6}$/); // #000 或 #000000
expect(result).toBe("hsla(0, 0%, 0%, 1)");
});
it("变亮 150% 应到白色", () => {
const result = scaleColorLight("#ffffff", 150);
expect(result).toMatch(/^#f{3,6}$/); // #fff 或 #ffffff
expect(result).toBe("hsla(0, 0%, 100%, 1)");
});
it("变暗 150% 应到黑色", () => {
const result = scaleColorLight("#000000", -150);
expect(result).toMatch(/^#0{3,6}$/); // #000 或 #000000
expect(result).toBe("hsla(0, 0%, 0%, 1)");
});
});
@@ -154,26 +144,26 @@ describe("scaleColorLight", () => {
it("GitHub 蓝色强调色变暗 12% (暗色主题 primary dark)", () => {
const result = scaleColorLight("#4493f8", -12);
expect(result).toBeTruthy();
expect(result).not.toBe("#4493f8");
expect(result).not.toBe("hsla(214, 93%, 62%, 1)");
});
it("GitHub 蓝色强调色变亮 12% (亮色主题 primary light)", () => {
const result = scaleColorLight("#0969da", 12);
expect(result).toBeTruthy();
expect(result).not.toBe("#0969da");
expect(result).not.toBe("hsla(212, 92%, 45%, 1)");
});
it("边框色变暗 6% (secondary dark 1)", () => {
const result = scaleColorLight("#d0d7de", -6);
expect(result).toBeTruthy();
expect(result).not.toBe("#d0d7de");
expect(result).not.toBe("hsla(210, 18%, 85%, 1)");
});
it("相同的绝对缩放值在暗/亮色上的方向效果不同", () => {
// 验证 scaleColorLight 不会改变色相 (hue)
const original = "#4493f8";
const darkened = scaleColorLight(original, -30);
const lightened = scaleColorLight(original, 30);
const original = "hsla(214, 93%, 62%, 1)";
const darkened = scaleColorLight("#4493f8", -30);
const lightened = scaleColorLight("#4493f8", 30);
// 两者都不等于原色
expect(darkened).not.toBe(original);
expect(lightened).not.toBe(original);
@@ -17,7 +17,13 @@
* limitations under the License.
*/
import { hsl, parseToHsl } from "polished";
import { rgba as c2kRgba, hsla, parseToHsla, parseToRgba } from "color2k";
/** 解析颜色后设置指定透明度,返回 rgba 字符串 */
export function rgba(color: string, alpha: number): string {
const [r, g, b] = parseToRgba(color);
return c2kRgba(r, g, b, alpha);
}
/**
* 改变颜色的亮度, 等同于 sass 中的 `color.scale` 函数
@@ -32,15 +38,15 @@ import { hsl, parseToHsl } from "polished";
* color: color.scale(#ff0000, $lightness: -20%)
*/
export function scaleColorLight(color: string, lightness: number) {
const hslColor = parseToHsl(color);
const [h, s, l] = parseToHsla(color);
let newLightness;
if (lightness < 0) {
newLightness = hslColor.lightness * (1 + lightness / 100); // 变暗
newLightness = l * (1 + lightness / 100); // 变暗
} else {
newLightness = hslColor.lightness + (1 - hslColor.lightness) * (lightness / 100); // 变亮
newLightness = l + (1 - l) * (lightness / 100); // 变亮
}
newLightness = Math.min(1, Math.max(0, newLightness)); // 确保亮度值在 0 到 1 之间
return hsl(hslColor.hue, hslColor.saturation, newLightness);
return hsla(h, s, newLightness, 1);
}
+1 -1
View File
@@ -17,5 +17,5 @@
* limitations under the License.
*/
export { scaleColorLight } from "./scss";
export { rgba, scaleColorLight } from "./color";
export { extractVarName } from "./var";
File diff suppressed because it is too large. Load diff
+14 -14
View File
@@ -306,9 +306,9 @@ exports[`display2GitHubColor > cover 后 contribution 颜色被改写 1`] = `
},
"primary": {
"bgColor": {
"active": "#da61a2",
"active": "hsla(328, 62%, 62%, 1)",
"disabled": "#105823",
"hover": "#d65299",
"hover": "hsla(328, 62%, 58%, 1)",
"rest": "#d34591",
},
"borderColor": {
@@ -330,7 +330,7 @@ exports[`display2GitHubColor > cover 后 contribution 颜色被改写 1`] = `
},
},
"star": {
"iconColor": "#ec6daf",
"iconColor": "hsla(329, 77%, 68%, 1)",
},
},
"buttonCounter": {
@@ -1792,7 +1792,7 @@ exports[`display2GitHubColor > cover 后 contribution 颜色被改写 1`] = `
},
"underlineNav": {
"borderColor": {
"active": "#f56bb3",
"active": "hsla(329, 87%, 69%, 1)",
"hover": "#3d444db3",
},
"iconColor": {
@@ -2108,9 +2108,9 @@ exports[`display2GitHubColor > cover 后 contribution 颜色被改写 2`] = `
},
"primary": {
"bgColor": {
"active": "#b92878",
"active": "hsla(327, 65%, 44%, 1)",
"disabled": "#95d8a6",
"hover": "#c42a7e",
"hover": "hsla(327, 65%, 47%, 1)",
"rest": "#ce2c85",
},
"borderColor": {
@@ -2132,7 +2132,7 @@ exports[`display2GitHubColor > cover 后 contribution 颜色被改写 2`] = `
},
},
"star": {
"iconColor": "#b82379",
"iconColor": "hsla(326, 68%, 43%, 1)",
},
},
"buttonCounter": {
@@ -3594,7 +3594,7 @@ exports[`display2GitHubColor > cover 后 contribution 颜色被改写 2`] = `
},
"underlineNav": {
"borderColor": {
"active": "#c7197c",
"active": "hsla(326, 78%, 44%, 1)",
"hover": "#d1d9e0b3",
},
"iconColor": {
@@ -3640,7 +3640,7 @@ exports[`display2GitHubColor > cover 后 contribution 颜色被改写 3`] = `
},
"bgColor": {
"accent": {
"emphasis": "#c64c8d",
"emphasis": "hsla(328, 52%, 54%, 1)",
"muted": "#451c35",
},
"attention": {
@@ -3910,10 +3910,10 @@ exports[`display2GitHubColor > cover 后 contribution 颜色被改写 3`] = `
},
"primary": {
"bgColor": {
"active": "#cd609a",
"active": "hsla(328, 52%, 59%, 1)",
"disabled": "#105823",
"hover": "#ca5794",
"rest": "#c64c8d",
"hover": "hsla(328, 52%, 57%, 1)",
"rest": "hsla(328, 52%, 54%, 1)",
},
"borderColor": {
"active": "#cdd9e526",
@@ -3934,7 +3934,7 @@ exports[`display2GitHubColor > cover 后 contribution 颜色被改写 3`] = `
},
},
"star": {
"iconColor": "#e475af",
"iconColor": "hsla(329, 67%, 68%, 1)",
},
},
"buttonCounter": {
@@ -5396,7 +5396,7 @@ exports[`display2GitHubColor > cover 后 contribution 颜色被改写 3`] = `
},
"underlineNav": {
"borderColor": {
"active": "#eb63a9",
"active": "hsla(329, 77%, 66%, 1)",
"hover": "#3d444db3",
},
"iconColor": {
+4 -4
View File
@@ -510,7 +510,7 @@ exports[`gitea2ThemeVars > dark 输出含 color 和 github 顶层键 1`] = `
},
"danger": {
"bgColor": {
"active": "rgba(219,40,40,0.4)",
"active": "rgba(219, 40, 40, 0.402)",
"hover": "#db28281a",
},
"fgColor": {
@@ -566,7 +566,7 @@ exports[`gitea2ThemeVars > dark 输出含 color 和 github 顶层键 1`] = `
"button": {
"primary": {
"fgColor": {
"accent": "#498fd5",
"accent": "hsla(210, 63%, 56%, 1)",
},
},
},
@@ -1105,7 +1105,7 @@ exports[`gitea2ThemeVars > dark 输出含 color 和 github 顶层键 2`] = `
},
"danger": {
"bgColor": {
"active": "rgba(219,40,40,0.4)",
"active": "rgba(219, 40, 40, 0.402)",
"hover": "#db28281a",
},
"fgColor": {
@@ -1161,7 +1161,7 @@ exports[`gitea2ThemeVars > dark 输出含 color 和 github 顶层键 2`] = `
"button": {
"primary": {
"fgColor": {
"accent": "#2c76bf",
"accent": "hsla(210, 63%, 46%, 1)",
},
},
},
+194 -194
View File
@@ -27,18 +27,18 @@ exports[`github2ThemeColor > dark isDarkTheme 为 true 1`] = `
},
"black": {
"dark": {
"num1": "#010408",
"num2": "#010307",
"num1": "hsla(218, 80%, 2%, 1)",
"num2": "hsla(218, 80%, 2%, 1)",
},
"light": "#08224c",
"light": "hsla(218, 80%, 17%, 1)",
"self": "#010409",
},
"blue": {
"dark": {
"num1": "#2c8eff",
"num2": "#0b7dff",
"num1": "hsla(212, 100%, 59%, 1)",
"num2": "hsla(212, 100%, 52%, 1)",
},
"light": "#68aeff",
"light": "hsla(212, 100%, 70%, 1)",
"self": "#4da0ff",
},
"body": "#0d1117",
@@ -51,10 +51,10 @@ exports[`github2ThemeColor > dark isDarkTheme 为 true 1`] = `
},
"brown": {
"dark": {
"num1": "#ac8d5a",
"num2": "#9b7d4e",
"num1": "hsla(37, 33%, 51%, 1)",
"num2": "hsla(37, 33%, 46%, 1)",
},
"light": "#c1a983",
"light": "hsla(37, 33%, 64%, 1)",
"self": "#b69a6d",
},
"button": "#212830",
@@ -119,7 +119,7 @@ exports[`github2ThemeColor > dark isDarkTheme 为 true 1`] = `
"error": {
"bg": {
"active": "#da3633",
"hover": "rgba(218,54,51,0.775)",
"hover": "rgba(216, 52, 50, 0.775)",
"self": "#f851491a",
},
"border": "#f8514966",
@@ -130,21 +130,21 @@ exports[`github2ThemeColor > dark isDarkTheme 为 true 1`] = `
"gold": "#ba9b12",
"green": {
"badge": {
"bg": "rgba(63,185,80,0.1)",
"bg": "rgba(63, 185, 80, 0.1)",
"hover": {
"bg": "rgba(63,185,80,0.3)",
"bg": "rgba(63, 185, 80, 0.3)",
},
"self": "#3fb950",
},
"dark": {
"num1": "#39a648",
"num2": "#329440",
"num1": "hsla(128, 49%, 44%, 1)",
"num2": "hsla(128, 49%, 39%, 1)",
},
"light": "#59c668",
"light": "hsla(128, 49%, 56%, 1)",
"self": "#3fb950",
},
"grey": {
"light": "#a2a7af",
"light": "hsla(214, 8%, 66%, 1)",
"self": "#9198a1",
},
"highlight": {
@@ -192,69 +192,69 @@ exports[`github2ThemeColor > dark isDarkTheme 为 true 1`] = `
},
"olive": {
"dark": {
"num1": "#929522",
"num2": "#82851e",
"num1": "hsla(62, 63%, 36%, 1)",
"num2": "hsla(62, 63%, 32%, 1)",
},
"light": "#c6cb2f",
"light": "hsla(62, 63%, 49%, 1)",
"self": "#a2a626",
},
"orange": {
"badge": {
"bg": "rgba(219,109,40,0.1)",
"bg": "rgba(219, 109, 40, 0.1)",
"hover": {
"bg": "rgba(219,109,40,0.3)",
"bg": "rgba(219, 109, 40, 0.3)",
},
"self": "#db6d28",
},
"dark": {
"num1": "#c86221",
"num2": "#b1571e",
"num1": "hsla(23, 71%, 46%, 1)",
"num2": "hsla(23, 71%, 41%, 1)",
},
"light": "#e08348",
"light": "hsla(23, 71%, 58%, 1)",
"self": "#db6d28",
},
"overlayBackdrop": "#21283066",
"pink": {
"dark": {
"num1": "#d54793",
"num2": "#ce2f84",
"num1": "hsla(328, 63%, 56%, 1)",
"num2": "hsla(328, 63%, 50%, 1)",
},
"light": "#e079b0",
"light": "hsla(328, 63%, 68%, 1)",
"self": "#db61a2",
},
"placeholderText": "var(--color-text-light-3)",
"primary": {
"active": "var(--color-primary-light-2)",
"alpha": {
"num10": "rgba(68,147,248,0.1)",
"num20": "rgba(68,147,248,0.2)",
"num30": "rgba(68,147,248,0.3)",
"num40": "rgba(68,147,248,0.4)",
"num50": "rgba(68,147,248,0.5)",
"num60": "rgba(68,147,248,0.6)",
"num70": "rgba(68,147,248,0.7)",
"num80": "rgba(68,147,248,0.8)",
"num90": "rgba(68,147,248,0.9)",
"num10": "rgba(68, 147, 248, 0.1)",
"num20": "rgba(68, 147, 248, 0.2)",
"num30": "rgba(68, 147, 248, 0.3)",
"num40": "rgba(68, 147, 248, 0.4)",
"num50": "rgba(68, 147, 248, 0.5)",
"num60": "rgba(68, 147, 248, 0.6)",
"num70": "rgba(68, 147, 248, 0.7)",
"num80": "rgba(68, 147, 248, 0.8)",
"num90": "rgba(68, 147, 248, 0.9)",
},
"contrast": "#f0f6fc",
"dark": {
"num1": "#5aa0f9",
"num2": "#71adfa",
"num3": "#87bafb",
"num4": "#9ec7fb",
"num5": "#b4d4fc",
"num6": "#cbe1fd",
"num7": "#e1eefe",
"num1": "hsla(214, 93%, 67%, 1)",
"num2": "hsla(214, 93%, 71%, 1)",
"num3": "hsla(214, 93%, 76%, 1)",
"num4": "hsla(214, 93%, 80%, 1)",
"num5": "hsla(214, 93%, 85%, 1)",
"num6": "hsla(214, 93%, 89%, 1)",
"num7": "hsla(214, 93%, 94%, 1)",
},
"hover": "var(--color-primary-light-1)",
"light": {
"num1": "#1f7ef7",
"num2": "#096ae7",
"num3": "#075ac3",
"num4": "#06499e",
"num5": "#05387a",
"num6": "#032755",
"num7": "#021631",
"num1": "hsla(214, 93%, 55%, 1)",
"num2": "hsla(214, 93%, 47%, 1)",
"num3": "hsla(214, 93%, 40%, 1)",
"num4": "hsla(214, 93%, 32%, 1)",
"num5": "hsla(214, 93%, 25%, 1)",
"num6": "hsla(214, 93%, 17%, 1)",
"num7": "hsla(214, 93%, 10%, 1)",
},
"self": "#4493f8",
},
@@ -266,10 +266,10 @@ exports[`github2ThemeColor > dark isDarkTheme 为 true 1`] = `
"projectColumnBg": "#010409",
"purple": {
"dark": {
"num1": "#945af6",
"num2": "#7d36f4",
"num1": "hsla(262, 90%, 66%, 1)",
"num2": "hsla(262, 90%, 59%, 1)",
},
"light": "#b890f9",
"light": "hsla(262, 90%, 77%, 1)",
"self": "#ab7df8",
},
"reaction": {
@@ -279,54 +279,54 @@ exports[`github2ThemeColor > dark isDarkTheme 为 true 1`] = `
},
"red": {
"badge": {
"bg": "rgba(248,81,73,0.1)",
"bg": "rgba(248, 81, 73, 0.1)",
"hover": {
"bg": "rgba(248,81,73,0.3)",
"bg": "rgba(248, 81, 73, 0.3)",
},
"self": "#f85149",
},
"dark": {
"num1": "#f7332a",
"num2": "#f6160b",
"num1": "hsla(3, 93%, 57%, 1)",
"num2": "hsla(3, 93%, 50%, 1)",
},
"light": "#f96b64",
"light": "hsla(3, 93%, 69%, 1)",
"self": "#f85149",
},
"secondary": {
"active": "var(--color-secondary-dark-2)",
"alpha": {
"num10": "rgba(61,68,77,0.1)",
"num20": "rgba(61,68,77,0.2)",
"num30": "rgba(61,68,77,0.3)",
"num40": "rgba(61,68,77,0.4)",
"num50": "rgba(61,68,77,0.5)",
"num60": "rgba(61,68,77,0.6)",
"num70": "rgba(61,68,77,0.7)",
"num80": "rgba(61,68,77,0.8)",
"num90": "rgba(61,68,77,0.9)",
"num10": "rgba(61, 68, 77, 0.1)",
"num20": "rgba(61, 68, 77, 0.2)",
"num30": "rgba(61, 68, 77, 0.3)",
"num40": "rgba(61, 68, 77, 0.4)",
"num50": "rgba(61, 68, 77, 0.5)",
"num60": "rgba(61, 68, 77, 0.6)",
"num70": "rgba(61, 68, 77, 0.7)",
"num80": "rgba(61, 68, 77, 0.8)",
"num90": "rgba(61, 68, 77, 0.9)",
},
"button": "var(--color-secondary-dark-4)",
"dark": {
"num1": "#474f59",
"num10": "#acb4bd",
"num11": "#b8bfc7",
"num12": "#c5cad1",
"num13": "#d5d9de",
"num2": "#515a66",
"num3": "#5b6572",
"num4": "#64707f",
"num5": "#6e7b8b",
"num6": "#7a8696",
"num7": "#8792a0",
"num8": "#939da9",
"num9": "#a0a8b3",
"num1": "hsla(214, 12%, 31%, 1)",
"num10": "hsla(214, 12%, 71%, 1)",
"num11": "hsla(214, 12%, 75%, 1)",
"num12": "hsla(214, 12%, 80%, 1)",
"num13": "hsla(214, 12%, 85%, 1)",
"num2": "hsla(214, 12%, 36%, 1)",
"num3": "hsla(214, 12%, 40%, 1)",
"num4": "hsla(214, 12%, 45%, 1)",
"num5": "hsla(214, 12%, 49%, 1)",
"num6": "hsla(214, 12%, 53%, 1)",
"num7": "hsla(214, 12%, 58%, 1)",
"num8": "hsla(214, 12%, 62%, 1)",
"num9": "hsla(214, 12%, 66%, 1)",
},
"hover": "var(--color-secondary-dark-3)",
"light": {
"num1": "#32383f",
"num2": "#272c31",
"num3": "#1c1f23",
"num4": "#111316",
"num1": "hsla(214, 12%, 22%, 1)",
"num2": "hsla(214, 12%, 17%, 1)",
"num3": "hsla(214, 12%, 12%, 1)",
"num4": "hsla(214, 12%, 8%, 1)",
},
"self": "#3d444d",
},
@@ -344,10 +344,10 @@ exports[`github2ThemeColor > dark isDarkTheme 为 true 1`] = `
},
"teal": {
"dark": {
"num1": "#199e9a",
"num2": "#168d89",
"num1": "hsla(178, 73%, 36%, 1)",
"num2": "hsla(178, 73%, 32%, 1)",
},
"light": "#22d8d1",
"light": "hsla(178, 73%, 49%, 1)",
"self": "#1cb0ab",
},
"text": {
@@ -373,10 +373,10 @@ exports[`github2ThemeColor > dark isDarkTheme 为 true 1`] = `
},
"violet": {
"dark": {
"num1": "#7779e6",
"num2": "#5658e0",
"num1": "hsla(239, 69%, 68%, 1)",
"num2": "hsla(239, 69%, 61%, 1)",
},
"light": "#a7a8ef",
"light": "hsla(239, 69%, 80%, 1)",
"self": "#9899ec",
},
"warning": {
@@ -388,17 +388,17 @@ exports[`github2ThemeColor > dark isDarkTheme 为 true 1`] = `
"workflowEdgeHover": "#1f6feb",
"yellow": {
"badge": {
"bg": "rgba(210,153,34,0.1)",
"bg": "rgba(210, 153, 34, 0.1)",
"hover": {
"bg": "rgba(210,153,34,0.3)",
"bg": "rgba(210, 153, 34, 0.3)",
},
"self": "#d29922",
},
"dark": {
"num1": "#bd8a1f",
"num2": "#a87a1b",
"num1": "hsla(41, 72%, 43%, 1)",
"num2": "hsla(41, 72%, 38%, 1)",
},
"light": "#dfab3c",
"light": "hsla(41, 72%, 56%, 1)",
"self": "#d29922",
},
},
@@ -566,14 +566,14 @@ exports[`github2ThemeColor > dark isDarkTheme 为 true 1`] = `
"button": {
"primary": {
"fgColor": {
"accent": "#43cf56",
"accent": "hsla(128, 59%, 54%, 1)",
},
},
},
"contribution": {
"default": {
"bgColor": {
"num5": "#aff6b7",
"num5": "hsla(127, 79%, 82%, 1)",
},
"borderColor": {
"num5": "#0104090d",
@@ -622,18 +622,18 @@ exports[`github2ThemeColor > dark isDarkTheme 为 true 2`] = `
},
"black": {
"dark": {
"num1": "#1c2024",
"num2": "#191c20",
"num1": "hsla(213, 13%, 13%, 1)",
"num2": "hsla(213, 13%, 11%, 1)",
},
"light": "#4f5966",
"light": "hsla(213, 13%, 35%, 1)",
"self": "#1f2328",
},
"blue": {
"dark": {
"num1": "#0056b8",
"num2": "#004ca3",
"num1": "hsla(212, 100%, 36%, 1)",
"num2": "hsla(212, 100%, 32%, 1)",
},
"light": "#1a84ff",
"light": "hsla(212, 100%, 55%, 1)",
"self": "#005fcc",
},
"body": "#ffffff",
@@ -646,10 +646,10 @@ exports[`github2ThemeColor > dark isDarkTheme 为 true 2`] = `
},
"brown": {
"dark": {
"num1": "#69563c",
"num2": "#5e4c36",
"num1": "hsla(34, 27%, 32%, 1)",
"num2": "hsla(34, 27%, 29%, 1)",
},
"light": "#a68964",
"light": "hsla(34, 27%, 52%, 1)",
"self": "#755f43",
},
"button": "#f6f8fa",
@@ -714,7 +714,7 @@ exports[`github2ThemeColor > dark isDarkTheme 为 true 2`] = `
"error": {
"bg": {
"active": "#cf222e",
"hover": "#db545c",
"hover": "rgba(219, 84, 93, 1)",
"self": "#ffebe9",
},
"border": "#ff818266",
@@ -725,21 +725,21 @@ exports[`github2ThemeColor > dark isDarkTheme 为 true 2`] = `
"gold": "#786002",
"green": {
"badge": {
"bg": "rgba(26,127,55,0.1)",
"bg": "rgba(26, 127, 55, 0.1)",
"hover": {
"bg": "rgba(26,127,55,0.3)",
"bg": "rgba(26, 127, 55, 0.3)",
},
"self": "#1a7f37",
},
"dark": {
"num1": "#177231",
"num2": "#15662c",
"num1": "hsla(137, 66%, 27%, 1)",
"num2": "hsla(137, 66%, 24%, 1)",
},
"light": "#29c957",
"light": "hsla(137, 66%, 48%, 1)",
"self": "#1a7f37",
},
"grey": {
"light": "#7e8a97",
"light": "hsla(211, 11%, 54%, 1)",
"self": "#59636e",
},
"highlight": {
@@ -787,69 +787,69 @@ exports[`github2ThemeColor > dark isDarkTheme 为 true 2`] = `
},
"olive": {
"dark": {
"num1": "#4d5e28",
"num2": "#455323",
"num1": "hsla(78, 41%, 26%, 1)",
"num2": "hsla(78, 41%, 23%, 1)",
},
"light": "#8ba847",
"light": "hsla(78, 41%, 47%, 1)",
"self": "#56682c",
},
"orange": {
"badge": {
"bg": "rgba(188,76,0,0.1)",
"bg": "rgba(188, 76, 0, 0.1)",
"hover": {
"bg": "rgba(188,76,0,0.3)",
"bg": "rgba(188, 76, 0, 0.3)",
},
"self": "#bc4c00",
},
"dark": {
"num1": "#a94400",
"num2": "#963d00",
"num1": "hsla(24, 100%, 33%, 1)",
"num2": "hsla(24, 100%, 29%, 1)",
},
"light": "#ff6f0e",
"light": "hsla(24, 100%, 53%, 1)",
"self": "#bc4c00",
},
"overlayBackdrop": "#c8d1da66",
"pink": {
"dark": {
"num1": "#ac337b",
"num2": "#992e6e",
"num1": "hsla(324, 54%, 44%, 1)",
"num2": "hsla(324, 54%, 39%, 1)",
},
"light": "#d268a7",
"light": "hsla(324, 54%, 61%, 1)",
"self": "#bf3989",
},
"placeholderText": "var(--color-text-light-3)",
"primary": {
"active": "var(--color-primary-dark-2)",
"alpha": {
"num10": "rgba(9,105,218,0.1)",
"num20": "rgba(9,105,218,0.2)",
"num30": "rgba(9,105,218,0.3)",
"num40": "rgba(9,105,218,0.4)",
"num50": "rgba(9,105,218,0.5)",
"num60": "rgba(9,105,218,0.6)",
"num70": "rgba(9,105,218,0.7)",
"num80": "rgba(9,105,218,0.8)",
"num90": "rgba(9,105,218,0.9)",
"num10": "rgba(9, 105, 218, 0.1)",
"num20": "rgba(9, 105, 218, 0.2)",
"num30": "rgba(9, 105, 218, 0.3)",
"num40": "rgba(9, 105, 218, 0.4)",
"num50": "rgba(9, 105, 218, 0.5)",
"num60": "rgba(9, 105, 218, 0.6)",
"num70": "rgba(9, 105, 218, 0.7)",
"num80": "rgba(9, 105, 218, 0.8)",
"num90": "rgba(9, 105, 218, 0.9)",
},
"contrast": "#1f2328",
"dark": {
"num1": "#085cc0",
"num2": "#0750a6",
"num3": "#06438c",
"num4": "#053771",
"num5": "#042a57",
"num6": "#031d3d",
"num7": "#011123",
"num1": "hsla(212, 92%, 39%, 1)",
"num2": "hsla(212, 92%, 34%, 1)",
"num3": "hsla(212, 92%, 28%, 1)",
"num4": "hsla(212, 92%, 23%, 1)",
"num5": "hsla(212, 92%, 18%, 1)",
"num6": "hsla(212, 92%, 12%, 1)",
"num7": "hsla(212, 92%, 7%, 1)",
},
"hover": "var(--color-primary-dark-1)",
"light": {
"num1": "#1079f5",
"num2": "#308bf6",
"num3": "#519ef8",
"num4": "#72b0f9",
"num5": "#92c2fb",
"num6": "#b3d4fc",
"num7": "#d4e7fd",
"num1": "hsla(212, 92%, 51%, 1)",
"num2": "hsla(212, 92%, 58%, 1)",
"num3": "hsla(212, 92%, 64%, 1)",
"num4": "hsla(212, 92%, 71%, 1)",
"num5": "hsla(212, 92%, 78%, 1)",
"num6": "hsla(212, 92%, 84%, 1)",
"num7": "hsla(212, 92%, 91%, 1)",
},
"self": "#0969da",
},
@@ -861,10 +861,10 @@ exports[`github2ThemeColor > dark isDarkTheme 为 true 2`] = `
"projectColumnBg": "#f6f8fa",
"purple": {
"dark": {
"num1": "#7036da",
"num2": "#6025cd",
"num1": "hsla(261, 69%, 53%, 1)",
"num2": "hsla(261, 69%, 48%, 1)",
},
"light": "#a17ce7",
"light": "hsla(261, 69%, 70%, 1)",
"self": "#8250df",
},
"reaction": {
@@ -874,54 +874,54 @@ exports[`github2ThemeColor > dark isDarkTheme 为 true 2`] = `
},
"red": {
"badge": {
"bg": "rgba(209,36,47,0.1)",
"bg": "rgba(209, 36, 47, 0.1)",
"hover": {
"bg": "rgba(209,36,47,0.3)",
"bg": "rgba(209, 36, 47, 0.3)",
},
"self": "#d1242f",
},
"dark": {
"num1": "#bc202a",
"num2": "#a71d26",
"num1": "hsla(356, 71%, 43%, 1)",
"num2": "hsla(356, 71%, 38%, 1)",
},
"light": "#e2555e",
"light": "hsla(356, 71%, 61%, 1)",
"self": "#d1242f",
},
"secondary": {
"active": "var(--color-secondary-dark-6)",
"alpha": {
"num10": "rgba(209,217,224,0.1)",
"num20": "rgba(209,217,224,0.2)",
"num30": "rgba(209,217,224,0.3)",
"num40": "rgba(209,217,224,0.4)",
"num50": "rgba(209,217,224,0.5)",
"num60": "rgba(209,217,224,0.6)",
"num70": "rgba(209,217,224,0.7)",
"num80": "rgba(209,217,224,0.8)",
"num90": "rgba(209,217,224,0.9)",
"num10": "rgba(209, 217, 224, 0.1)",
"num20": "rgba(209, 217, 224, 0.2)",
"num30": "rgba(209, 217, 224, 0.3)",
"num40": "rgba(209, 217, 224, 0.4)",
"num50": "rgba(209, 217, 224, 0.5)",
"num60": "rgba(209, 217, 224, 0.6)",
"num70": "rgba(209, 217, 224, 0.7)",
"num80": "rgba(209, 217, 224, 0.8)",
"num90": "rgba(209, 217, 224, 0.9)",
},
"button": "var(--color-secondary-dark-4)",
"dark": {
"num1": "#c1ccd6",
"num10": "#465867",
"num11": "#3b4b58",
"num12": "#313d48",
"num13": "#232c34",
"num2": "#b2bfcb",
"num3": "#a2b3c1",
"num4": "#93a6b6",
"num5": "#8399ac",
"num6": "#748ca1",
"num7": "#657f96",
"num8": "#5b7287",
"num9": "#506577",
"num1": "hsla(208, 19%, 80%, 1)",
"num10": "hsla(208, 19%, 34%, 1)",
"num11": "hsla(208, 19%, 29%, 1)",
"num12": "hsla(208, 19%, 24%, 1)",
"num13": "hsla(208, 19%, 17%, 1)",
"num2": "hsla(208, 19%, 75%, 1)",
"num3": "hsla(208, 19%, 70%, 1)",
"num4": "hsla(208, 19%, 65%, 1)",
"num5": "hsla(208, 19%, 59%, 1)",
"num6": "hsla(208, 19%, 54%, 1)",
"num7": "hsla(208, 19%, 49%, 1)",
"num8": "hsla(208, 19%, 44%, 1)",
"num9": "hsla(208, 19%, 39%, 1)",
},
"hover": "var(--color-secondary-dark-5)",
"light": {
"num1": "#d9e0e6",
"num2": "#e2e7eb",
"num3": "#eaeef1",
"num4": "#f2f4f6",
"num1": "hsla(208, 19%, 88%, 1)",
"num2": "hsla(208, 19%, 90%, 1)",
"num3": "hsla(208, 19%, 93%, 1)",
"num4": "hsla(208, 19%, 96%, 1)",
},
"self": "#d1d9e0",
},
@@ -939,10 +939,10 @@ exports[`github2ThemeColor > dark isDarkTheme 为 true 2`] = `
},
"teal": {
"dark": {
"num1": "#0e6369",
"num2": "#0d585e",
"num1": "hsla(184, 76%, 23%, 1)",
"num2": "hsla(184, 76%, 21%, 1)",
},
"light": "#1bbcc8",
"light": "hsla(184, 76%, 45%, 1)",
"self": "#106e75",
},
"text": {
@@ -968,10 +968,10 @@ exports[`github2ThemeColor > dark isDarkTheme 为 true 2`] = `
},
"violet": {
"dark": {
"num1": "#3036db",
"num2": "#2329c9",
"num1": "hsla(238, 70%, 52%, 1)",
"num2": "hsla(238, 70%, 46%, 1)",
},
"light": "#777ae7",
"light": "hsla(238, 70%, 69%, 1)",
"self": "#494edf",
},
"warning": {
@@ -983,17 +983,17 @@ exports[`github2ThemeColor > dark isDarkTheme 为 true 2`] = `
"workflowEdgeHover": "#0969da",
"yellow": {
"badge": {
"bg": "rgba(154,103,0,0.1)",
"bg": "rgba(154, 103, 0, 0.1)",
"hover": {
"bg": "rgba(154,103,0,0.3)",
"bg": "rgba(154, 103, 0, 0.3)",
},
"self": "#9a6700",
},
"dark": {
"num1": "#8b5d00",
"num2": "#7b5200",
"num1": "hsla(40, 100%, 27%, 1)",
"num2": "hsla(40, 100%, 24%, 1)",
},
"light": "#f3a300",
"light": "hsla(40, 100%, 48%, 1)",
"self": "#9a6700",
},
},
@@ -1161,14 +1161,14 @@ exports[`github2ThemeColor > dark isDarkTheme 为 true 2`] = `
"button": {
"primary": {
"fgColor": {
"accent": "#10792e",
"accent": "hsla(137, 76%, 27%, 1)",
},
},
},
"contribution": {
"default": {
"bgColor": {
"num5": "#022f0f",
"num5": "hsla(138, 93%, 10%, 1)",
},
"borderColor": {
"num5": "#1f23280d",
+8 -8
View File
@@ -18,8 +18,8 @@
*/
import type { CatppuccinFlavor } from "@catppuccin/palette";
import { darken, lighten, mix, rgba, saturate } from "polished";
import { scaleColorLight } from "../functions";
import { darken, lighten, mix, saturate } from "color2k";
import { rgba, scaleColorLight } from "../functions";
import type { Ansi, Console, Diff, GitHub, Other } from "../types";
import { themeVars } from "../types";
import type { ThemeColor } from "./theme";
@@ -30,7 +30,7 @@ import type { ThemeColor } from "./theme";
export function catppuccin2ThemeColor(flavor: CatppuccinFlavor): ThemeColor {
const accentColor = flavor.colors.mauve.hex;
// 颜色偏向 base, 避免 latte 下与背景色相同
const buttonColor = mix(0.6, flavor.colors.base.hex, flavor.colors.surface0.hex);
const buttonColor = mix(flavor.colors.base.hex, flavor.colors.surface0.hex, 0.4);
const ansi: Ansi = {
black: flavor.ansiColors.black.normal.hex,
@@ -89,7 +89,7 @@ export function catppuccin2ThemeColor(flavor: CatppuccinFlavor): ThemeColor {
logo: themeVars.color.primary.self,
body: flavor.colors.base.hex,
box: {
header: mix(0.65, flavor.colors.base.hex, flavor.colors.surface0.hex),
header: mix(flavor.colors.base.hex, flavor.colors.surface0.hex, 0.35),
body: { self: themeVars.color.body, highlight: rgba(accentColor, 0.2) },
},
text: {
@@ -188,8 +188,8 @@ export function catppuccin2ThemeColor(flavor: CatppuccinFlavor): ThemeColor {
fgColor: { rest: flavor.colors.base.hex },
bgColor: {
rest: flavor.colors.green.hex,
hover: lighten(0.05, flavor.colors.green.hex),
active: saturate(0.05, flavor.colors.green.hex),
hover: lighten(flavor.colors.green.hex, 0.05),
active: saturate(flavor.colors.green.hex, 0.05),
},
borderColor: { rest: flavor.colors.green.hex, hover: flavor.colors.green.hex },
},
@@ -198,7 +198,7 @@ export function catppuccin2ThemeColor(flavor: CatppuccinFlavor): ThemeColor {
bgColor: {
rest: buttonColor,
hover: flavor.colors.red.hex,
active: darken(0.05, flavor.colors.red.hex),
active: darken(flavor.colors.red.hex, 0.05),
},
borderColor: { hover: flavor.colors.red.hex },
},
@@ -262,7 +262,7 @@ export function catppuccin2ThemeColor(flavor: CatppuccinFlavor): ThemeColor {
button: { primary: { fgColor: { accent: flavor.colors.green.hex } } },
contribution: {
default: {
bgColor: { num5: saturate(0.1, scaleColorLight(accentColor, flavor.dark ? 25 : -25)) },
bgColor: { num5: saturate(scaleColorLight(accentColor, flavor.dark ? 25 : -25), 0.1) },
borderColor: { num5: themeVars.github.contribution.default.borderColor.num0 },
},
},
+1 -1
View File
@@ -18,7 +18,7 @@
*/
import type { CatppuccinFlavor } from "@catppuccin/palette";
import { rgba } from "polished";
import { rgba } from "../functions";
import type { Syntax } from "../types";
/**
+7 -7
View File
@@ -18,7 +18,7 @@
*/
import type { Primer } from "@lutinglt/gitea-github-theme/primer";
import { saturate } from "polished";
import { saturate } from "color2k";
import { scaleColorLight } from "../functions";
import { deepOverride } from "../utils";
import type { GitHubColor } from "./github";
@@ -35,7 +35,7 @@ export function display2GitHubColor(
fgColor: { accent: soft ? displayColor[7] : displayColor[6] },
bgColor: {
accent: {
emphasis: soft ? saturate(-0.1, scaleColorLight(displayColor[5], -2)) : displayColor[5],
emphasis: soft ? saturate(scaleColorLight(displayColor[5], -2), -0.1) : displayColor[5],
muted: soft ? displayColor[1] : displayColor[0],
},
},
@@ -46,26 +46,26 @@ export function display2GitHubColor(
rest: baseGitHubColor.button.primary.fgColor.rest,
},
bgColor: {
rest: soft ? saturate(-0.1, scaleColorLight(displayColor[5], -2)) : displayColor[5],
rest: soft ? saturate(scaleColorLight(displayColor[5], -2), -0.1) : displayColor[5],
hover: soft
? saturate(-0.1, scaleColorLight(displayColor[5], 4))
? saturate(scaleColorLight(displayColor[5], 4), -0.1)
: baseGitHubColor.isDarkTheme
? scaleColorLight(displayColor[5], 7)
: scaleColorLight(displayColor[5], -5),
active: soft
? saturate(-0.1, scaleColorLight(displayColor[5], 9))
? saturate(scaleColorLight(displayColor[5], 9), -0.1)
: baseGitHubColor.isDarkTheme
? scaleColorLight(displayColor[5], 15)
: scaleColorLight(displayColor[5], -10),
},
},
star: {
iconColor: soft ? scaleColorLight(displayColor[6], -2) : saturate(0.1, scaleColorLight(displayColor[6], -2)),
iconColor: soft ? scaleColorLight(displayColor[6], -2) : saturate(scaleColorLight(displayColor[6], -2), 0.1),
},
},
underlineNav: {
borderColor: {
active: soft ? scaleColorLight(saturate(0.1, displayColor[6]), -5) : saturate(0.2, displayColor[6]),
active: soft ? scaleColorLight(saturate(displayColor[6], 0.1), -5) : saturate(displayColor[6], 0.2),
},
},
contribution: {
+3 -3
View File
@@ -17,7 +17,7 @@
* limitations under the License.
*/
import { opacify, saturate } from "polished";
import { opacify, saturate } from "color2k";
import type { ThemeVars } from "../core";
import { scaleColorLight } from "../functions";
import type { Ansi, Console, Diff, GitHub, Message, Named, Other, Primary, Secondary } from "../types";
@@ -107,7 +107,7 @@ export function gitea2ThemeVars(giteaColor: GiteaColor): ThemeVars {
fgColor: { hover: giteaColor.named.red.light },
bgColor: {
hover: giteaColor.named.red.badge.bg,
active: opacify(0.3, giteaColor.named.red.badge.bg),
active: opacify(giteaColor.named.red.badge.bg, 0.3),
},
},
},
@@ -152,7 +152,7 @@ export function gitea2ThemeVars(giteaColor: GiteaColor): ThemeVars {
button: {
primary: {
fgColor: {
accent: saturate(0.1, scaleColorLight(giteaColor.primary.self, giteaColor.isDarkTheme ? 10 : -10)),
accent: saturate(scaleColorLight(giteaColor.primary.self, giteaColor.isDarkTheme ? 10 : -10), 0.1),
},
},
},
+6 -6
View File
@@ -18,7 +18,7 @@
*/
import type { Primer } from "@lutinglt/gitea-github-theme/primer";
import { mix, saturate } from "polished";
import { mix, saturate } from "color2k";
import { scaleColorLight } from "../functions";
import type { Ansi, Console, Diff, GitHub, Message, Other } from "../types";
import { themeVars } from "../types";
@@ -55,7 +55,7 @@ export function github2ThemeColor(githubColor: GitHubColor): ThemeColor {
bg: {
self: githubColor.bgColor.danger.muted,
active: githubColor.bgColor.danger.emphasis,
hover: mix(0.25, githubColor.bgColor.danger.muted, githubColor.bgColor.danger.emphasis),
hover: mix(githubColor.bgColor.danger.muted, githubColor.bgColor.danger.emphasis, 0.75),
},
border: githubColor.borderColor.danger.muted,
text: githubColor.fgColor.danger, // Gitea 用处更多, 不与 GitHub 保持一致
@@ -291,8 +291,8 @@ export function github2ThemeColor(githubColor: GitHubColor): ThemeColor {
primary: {
fgColor: {
accent: saturate(
0.1,
scaleColorLight(githubColor.themeExtra.button.primary.fgColor.accent, githubColor.isDarkTheme ? 10 : -10)
scaleColorLight(githubColor.themeExtra.button.primary.fgColor.accent, githubColor.isDarkTheme ? 10 : -10),
0.1
),
},
},
@@ -301,8 +301,8 @@ export function github2ThemeColor(githubColor: GitHubColor): ThemeColor {
default: {
bgColor: {
num5: saturate(
0.2,
scaleColorLight(githubColor.contribution.default.bgColor[4], githubColor.isDarkTheme ? 58 : -58)
scaleColorLight(githubColor.contribution.default.bgColor[4], githubColor.isDarkTheme ? 58 : -58),
0.2
),
},
borderColor: { num5: githubColor.contribution.default.borderColor[4] },
+7 -7
View File
@@ -17,9 +17,9 @@
* limitations under the License.
*/
import { rgba, saturate } from "polished";
import { saturate } from "color2k";
import type { ThemeVars } from "../core";
import { scaleColorLight } from "../functions";
import { rgba, scaleColorLight } from "../functions";
import type { Ansi, Console, Diff, GitHub, Message, Named, Other, Primary, Secondary } from "../types";
import { themeVars } from "../types";
@@ -328,27 +328,27 @@ export function theme2ThemeVars(themeColor: ThemeColor): ThemeVars {
hover: rgba(themeColor.base.red, 0.3),
},
border: rgba(themeColor.base.red, 0.4),
text: saturate(0.2, themeColor.base.red), // 饱和度提高
text: saturate(themeColor.base.red, 0.2), // 饱和度提高
},
success: {
bg: rgba(themeColor.base.green, 0.1),
border: rgba(themeColor.base.green, 0.4),
text: saturate(0.2, themeColor.base.green),
text: saturate(themeColor.base.green, 0.2),
},
warning: {
bg: rgba(themeColor.base.yellow, 0.1),
border: rgba(themeColor.base.yellow, 0.4),
text: saturate(0.2, themeColor.base.yellow),
text: saturate(themeColor.base.yellow, 0.2),
},
info: {
bg: rgba(themeColor.base.blue, 0.1),
border: rgba(themeColor.base.blue, 0.4),
text: saturate(0.2, themeColor.base.blue),
text: saturate(themeColor.base.blue, 0.2),
},
priority: {
bg: rgba(themeColor.base.purple, 0.1),
border: rgba(themeColor.base.purple, 0.4),
text: saturate(0.2, themeColor.base.purple),
text: saturate(themeColor.base.purple, 0.2),
},
};