mirror of
https://github.com/lutinglt/gitea-github-theme.git
synced 2026-10-28 09:44:55 +00:00
mv gitea primer to assets
This commit is contained in:
45 files changed
+46
-45
No files matched your search
File renamed without changes.
File renamed without changes.
Generated
File renamed without changes.
Generated
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Generated
+1
@@ -0,0 +1 @@
|
||||
export { default as primer, type Primer } from "./primer";
|
||||
File renamed without changes.
File renamed without changes.
@@ -842,7 +842,7 @@ export default {
|
||||
danger: "#f0883e",
|
||||
closed: "#9198a1",
|
||||
draft: "#9198a1",
|
||||
done: "#ab7df8",
|
||||
done: "#b7bdc8",
|
||||
upsell: "#ab7df8",
|
||||
sponsors: "#db61a2",
|
||||
},
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Generated
File renamed without changes.
File renamed without changes.
File renamed without changes.
Generated
File renamed without changes.
File renamed without changes.
File renamed without changes.
+1
-1
@@ -16,7 +16,7 @@
|
||||
"./styles": "./styles/index.ts",
|
||||
"./styles/common": "./styles/common/index.ts",
|
||||
"./themes": "./themes/index.ts",
|
||||
"./primer": "./primer/index.ts"
|
||||
"./assets": "./assets/index.ts"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "bunx --bun eslint .",
|
||||
|
||||
@@ -22,7 +22,7 @@ import { typescript } from "@primer/primitives/dist/build/platforms/typescript.j
|
||||
import { PrimerStyleDictionary } from "@primer/primitives/dist/build/primerStyleDictionary.js";
|
||||
import { themes as primerThemes } from "./themes.config.ts";
|
||||
|
||||
const buildPath = "primer";
|
||||
const buildPath = "assets/primer";
|
||||
const primerModulePath = "node_modules/@primer/primitives";
|
||||
|
||||
const themes = primerThemes.map(({ filename, source, include, theme }) => ({
|
||||
|
||||
@@ -26,7 +26,7 @@ setGlobalProxy();
|
||||
const githubSite = "https://raw.githubusercontent.com";
|
||||
const githubRepo = "lsd-techno/gitea-theme";
|
||||
const githubBranchPath = "refs/heads/main";
|
||||
const localGiteaPath = path.join(rootDir, "assets");
|
||||
const localGiteaPath = path.join(rootDir, "assets/gitea-theme");
|
||||
const githubBaseUrl = `${githubSite}/${githubRepo}/${githubBranchPath}`;
|
||||
const file = "theme-arc-green-updated.css";
|
||||
const fileUrl = `${githubBaseUrl}/${file}`;
|
||||
|
||||
@@ -26,7 +26,7 @@ setGlobalProxy();
|
||||
const githubSite = "https://raw.githubusercontent.com";
|
||||
const giteaRepo = "go-gitea/gitea";
|
||||
const githubTagPath = "refs/tags";
|
||||
const localGiteaPath = path.join(rootDir, "gitea");
|
||||
const localGiteaPath = path.join(rootDir, "assets/gitea");
|
||||
const [major, minor, patch = ""] = pkg.version.split(".");
|
||||
console.log("Version:", pkg.version);
|
||||
const versionPath = `${githubTagPath}/v${major}.${minor}.${patch}`;
|
||||
|
||||
+11
-11
@@ -17,7 +17,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import defaultPrimer from "@lutinglt/gitea-github-theme/primer";
|
||||
import { primer } from "@lutinglt/gitea-github-theme/assets";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { display2GitHubColor } from "./display";
|
||||
import { primer2GitHubColor } from "./primer";
|
||||
@@ -27,35 +27,35 @@ import { primer2GitHubColor } from "./primer";
|
||||
// ============================================================================
|
||||
|
||||
describe("display2GitHubColor", () => {
|
||||
const darkBase = primer2GitHubColor(defaultPrimer.dark, true);
|
||||
const lightBase = primer2GitHubColor(defaultPrimer.light);
|
||||
const darkBase = primer2GitHubColor(primer.dark, true);
|
||||
const lightBase = primer2GitHubColor(primer.light);
|
||||
|
||||
it("pink dark 快照", () => {
|
||||
expect(display2GitHubColor(defaultPrimer.dark.display.pink.scale, darkBase)).toMatchSnapshot();
|
||||
expect(display2GitHubColor(primer.dark.display.pink.scale, darkBase)).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("pink light 快照", () => {
|
||||
expect(display2GitHubColor(defaultPrimer.light.display.pink.scale, lightBase)).toMatchSnapshot();
|
||||
expect(display2GitHubColor(primer.light.display.pink.scale, lightBase)).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("pink soft-dark 快照", () => {
|
||||
const softDarkBase = primer2GitHubColor(defaultPrimer.darkDimmed, true);
|
||||
expect(display2GitHubColor(defaultPrimer.dark.display.pink.scale, softDarkBase, true)).toMatchSnapshot();
|
||||
const softDarkBase = primer2GitHubColor(primer.darkDimmed, true);
|
||||
expect(display2GitHubColor(primer.dark.display.pink.scale, softDarkBase, true)).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("cover 后 accent 字段与 base 不同", () => {
|
||||
const result = display2GitHubColor(defaultPrimer.dark.display.pink.scale, darkBase);
|
||||
const result = display2GitHubColor(primer.dark.display.pink.scale, darkBase);
|
||||
expect(result.fgColor.accent).not.toBe(darkBase.fgColor.accent);
|
||||
expect(result.bgColor.accent.emphasis).not.toBe(darkBase.bgColor.accent.emphasis);
|
||||
});
|
||||
|
||||
it("cover 后 contribution 颜色被改写", () => {
|
||||
const result = display2GitHubColor(defaultPrimer.light.display.pink.scale, lightBase);
|
||||
const result = display2GitHubColor(primer.light.display.pink.scale, lightBase);
|
||||
expect(result.contribution.default.bgColor[1]).not.toBe(lightBase.contribution.default.bgColor[1]);
|
||||
});
|
||||
|
||||
it("isDarkTheme 遵循 base", () => {
|
||||
expect(display2GitHubColor(defaultPrimer.dark.display.pink.scale, darkBase).isDarkTheme).toBe(true);
|
||||
expect(display2GitHubColor(defaultPrimer.light.display.pink.scale, lightBase).isDarkTheme).toBe(false);
|
||||
expect(display2GitHubColor(primer.dark.display.pink.scale, darkBase).isDarkTheme).toBe(true);
|
||||
expect(display2GitHubColor(primer.light.display.pink.scale, lightBase).isDarkTheme).toBe(false);
|
||||
});
|
||||
});
|
||||
@@ -17,7 +17,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { Primer } from "@lutinglt/gitea-github-theme/primer";
|
||||
import type { Primer } from "@lutinglt/gitea-github-theme/assets";
|
||||
import { saturate } from "color2k";
|
||||
import { scaleColorLight } from "../functions";
|
||||
import { deepOverride } from "../utils";
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import defaultPrimer from "@lutinglt/gitea-github-theme/primer";
|
||||
import { primer } from "@lutinglt/gitea-github-theme/assets";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { github2ThemeColor } from "./github";
|
||||
import { primer2GitHubColor } from "./primer";
|
||||
@@ -109,30 +109,30 @@ function assertThemeColorStructure(themeColor: ThemeColor, flavor: string) {
|
||||
|
||||
describe("github2ThemeColor", () => {
|
||||
it("dark 全链快照", () => {
|
||||
const githubColor = primer2GitHubColor(defaultPrimer.dark, true);
|
||||
const githubColor = primer2GitHubColor(primer.dark, true);
|
||||
expect(theme2ThemeVars(github2ThemeColor(githubColor))).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("light 全链快照", () => {
|
||||
const githubColor = primer2GitHubColor(defaultPrimer.light);
|
||||
const githubColor = primer2GitHubColor(primer.light);
|
||||
expect(theme2ThemeVars(github2ThemeColor(githubColor))).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("dark 结构完整", () => {
|
||||
assertThemeColorStructure(github2ThemeColor(primer2GitHubColor(defaultPrimer.dark, true)), "github-dark");
|
||||
assertThemeColorStructure(github2ThemeColor(primer2GitHubColor(primer.dark, true)), "github-dark");
|
||||
});
|
||||
|
||||
it("light 结构完整", () => {
|
||||
assertThemeColorStructure(github2ThemeColor(primer2GitHubColor(defaultPrimer.light)), "github-light");
|
||||
assertThemeColorStructure(github2ThemeColor(primer2GitHubColor(primer.light)), "github-light");
|
||||
});
|
||||
|
||||
it("dark isDarkTheme 为 true", () => {
|
||||
const githubColor = primer2GitHubColor(defaultPrimer.dark, true);
|
||||
const githubColor = primer2GitHubColor(primer.dark, true);
|
||||
expect(github2ThemeColor(githubColor).isDarkTheme).toBe(true);
|
||||
});
|
||||
|
||||
it("light isDarkTheme 为 false", () => {
|
||||
const githubColor = primer2GitHubColor(defaultPrimer.light);
|
||||
const githubColor = primer2GitHubColor(primer.light);
|
||||
expect(github2ThemeColor(githubColor).isDarkTheme).toBe(false);
|
||||
});
|
||||
});
|
||||
@@ -17,7 +17,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { Primer } from "@lutinglt/gitea-github-theme/primer";
|
||||
import type { Primer } from "@lutinglt/gitea-github-theme/assets";
|
||||
import { mix, saturate } from "color2k";
|
||||
import { scaleColorLight } from "../functions";
|
||||
import type { Ansi, Console, Diff, GitHub, Message, Other, Series16 } from "../types";
|
||||
|
||||
+16
-16
@@ -17,7 +17,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import defaultPrimer from "@lutinglt/gitea-github-theme/primer";
|
||||
import { primer } from "@lutinglt/gitea-github-theme/assets";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { primer2Chroma, primer2CodeMirror, primer2GitHubColor } from "./primer";
|
||||
|
||||
@@ -27,23 +27,23 @@ import { primer2Chroma, primer2CodeMirror, primer2GitHubColor } from "./primer";
|
||||
|
||||
describe("primer2GitHubColor", () => {
|
||||
it("dark 快照", () => {
|
||||
expect(primer2GitHubColor(defaultPrimer.dark, true)).toMatchSnapshot();
|
||||
expect(primer2GitHubColor(primer.dark, true)).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("light 快照", () => {
|
||||
expect(primer2GitHubColor(defaultPrimer.light)).toMatchSnapshot();
|
||||
expect(primer2GitHubColor(primer.light)).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("dark isDarkTheme 为 true", () => {
|
||||
expect(primer2GitHubColor(defaultPrimer.dark, true).isDarkTheme).toBe(true);
|
||||
expect(primer2GitHubColor(primer.dark, true).isDarkTheme).toBe(true);
|
||||
});
|
||||
|
||||
it("light isDarkTheme 为 false", () => {
|
||||
expect(primer2GitHubColor(defaultPrimer.light).isDarkTheme).toBe(false);
|
||||
expect(primer2GitHubColor(primer.light).isDarkTheme).toBe(false);
|
||||
});
|
||||
|
||||
it("dark 包含 fgColor/bgColor/borderColor", () => {
|
||||
const result = primer2GitHubColor(defaultPrimer.dark, true);
|
||||
const result = primer2GitHubColor(primer.dark, true);
|
||||
expect(result.fgColor).toBeDefined();
|
||||
expect(result.bgColor).toBeDefined();
|
||||
expect(result.borderColor).toBeDefined();
|
||||
@@ -56,15 +56,15 @@ describe("primer2GitHubColor", () => {
|
||||
|
||||
describe("primer2Chroma", () => {
|
||||
it("dark 快照", () => {
|
||||
expect(primer2Chroma(defaultPrimer.dark)).toMatchSnapshot();
|
||||
expect(primer2Chroma(primer.dark)).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("light 快照", () => {
|
||||
expect(primer2Chroma(defaultPrimer.light)).toMatchSnapshot();
|
||||
expect(primer2Chroma(primer.light)).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("包含所有语法分组", () => {
|
||||
const result = primer2Chroma(defaultPrimer.dark);
|
||||
const result = primer2Chroma(primer.dark);
|
||||
const groups = [
|
||||
"textWhiteSpace",
|
||||
"err",
|
||||
@@ -84,14 +84,14 @@ describe("primer2Chroma", () => {
|
||||
});
|
||||
|
||||
it("keyword 含子级分组", () => {
|
||||
const kw = primer2Chroma(defaultPrimer.dark).keyword as Record<string, unknown>;
|
||||
const kw = primer2Chroma(primer.dark).keyword as Record<string, unknown>;
|
||||
for (const sub of ["self", "constant", "declaration", "namespace", "pseudo", "reserved", "type"]) {
|
||||
expect(kw[sub], `缺少 keyword.${sub}`).toBeDefined();
|
||||
}
|
||||
});
|
||||
|
||||
it("generic 含 deleted/emph/inserted/heading", () => {
|
||||
const g = primer2Chroma(defaultPrimer.dark).generic as Record<string, unknown>;
|
||||
const g = primer2Chroma(primer.dark).generic as Record<string, unknown>;
|
||||
for (const sub of ["deleted", "emph", "inserted", "heading", "subheading"]) {
|
||||
expect(g[sub], `缺少 generic.${sub}`).toBeDefined();
|
||||
}
|
||||
@@ -104,28 +104,28 @@ describe("primer2Chroma", () => {
|
||||
|
||||
describe("primer2CodeMirror", () => {
|
||||
it("dark 快照", () => {
|
||||
expect(primer2CodeMirror(defaultPrimer.dark)).toMatchSnapshot();
|
||||
expect(primer2CodeMirror(primer.dark)).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("light 快照", () => {
|
||||
expect(primer2CodeMirror(defaultPrimer.light)).toMatchSnapshot();
|
||||
expect(primer2CodeMirror(primer.light)).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("含 token 和 language 分组", () => {
|
||||
const result = primer2CodeMirror(defaultPrimer.dark);
|
||||
const result = primer2CodeMirror(primer.dark);
|
||||
expect(result.token).toBeDefined();
|
||||
expect(result.language).toBeDefined();
|
||||
});
|
||||
|
||||
it("token 含核心语法键", () => {
|
||||
const t = primer2CodeMirror(defaultPrimer.dark).token as Record<string, unknown>;
|
||||
const t = primer2CodeMirror(primer.dark).token as Record<string, unknown>;
|
||||
for (const key of ["keyword", "atom", "string", "number", "comment", "variableName", "typeName"]) {
|
||||
expect(t[key], `缺少 token.${key}`).toBeDefined();
|
||||
}
|
||||
});
|
||||
|
||||
it("language 含 json/html/css/xml", () => {
|
||||
const l = primer2CodeMirror(defaultPrimer.dark).language;
|
||||
const l = primer2CodeMirror(primer.dark).language;
|
||||
for (const key of ["json", "html", "css", "xml"]) {
|
||||
expect(l[key as keyof typeof l], `缺少 language.${key}`).toBeDefined();
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { Primer } from "@lutinglt/gitea-github-theme/primer";
|
||||
import type { Primer } from "@lutinglt/gitea-github-theme/assets";
|
||||
import type { Chroma, CodeMirror } from "../types";
|
||||
import { deepOverride } from "../utils";
|
||||
import type { GitHubColor } from "./github";
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@
|
||||
|
||||
import type { GitHubColor } from "@lutinglt/gitea-github-theme/core";
|
||||
import { deepOverride, defineTheme, display2GitHubColor, primer2GitHubColor } from "@lutinglt/gitea-github-theme/core";
|
||||
import { default as primer } from "@lutinglt/gitea-github-theme/primer";
|
||||
import { primer } from "@lutinglt/gitea-github-theme/assets";
|
||||
|
||||
/** - 仅适用于 Dark 主题的颜色转换 */
|
||||
function darkConvert(color: GitHubColor) {
|
||||
|
||||
+2
-2
@@ -33,7 +33,7 @@
|
||||
"@lutinglt/gitea-github-theme/styles": ["./styles"],
|
||||
"@lutinglt/gitea-github-theme/styles/common": ["./styles/common"],
|
||||
"@lutinglt/gitea-github-theme/themes": ["./themes"],
|
||||
"@lutinglt/gitea-github-theme/primer": ["./primer"]
|
||||
"@lutinglt/gitea-github-theme/assets": ["./assets"]
|
||||
}
|
||||
},
|
||||
"include": [
|
||||
@@ -41,7 +41,7 @@
|
||||
"styles",
|
||||
"themes",
|
||||
"scripts",
|
||||
"primer",
|
||||
"assets/primer",
|
||||
"eslint.config.ts",
|
||||
"vite.config.ts",
|
||||
"theme.config.ts",
|
||||
|
||||
Reference in new issue
Block a user