chore(vendor): import pi 1.3.0
Imported as a linear vendor commit so forge rebases do not replay the upstream root tree. git-subtree-dir: third_party/pi git-subtree-split: 71023aec1546d6d677a65669c5665c0927ce0dd0
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { colorToHex, okhslColor } from "@earendil-works/pi-tui";
|
||||
import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "fs";
|
||||
import { tmpdir } from "os";
|
||||
import { join } from "path";
|
||||
@@ -69,6 +70,28 @@ describe("getThemeExportColors", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("converts OKHSL export colors to hex because CSS does not support them", () => {
|
||||
const darkTheme = JSON.parse(
|
||||
readFileSync(new URL("../src/modes/interactive/theme/dark.json", import.meta.url), "utf-8"),
|
||||
) as ThemeFile;
|
||||
const customTheme: ThemeFile = {
|
||||
...darkTheme,
|
||||
name: "custom-export-okhsl",
|
||||
vars: { card: "okhsl(250 20% 20%)" },
|
||||
export: { pageBg: "okhsl(250 20% 15%)", cardBg: "card", infoBg: "oklch(30% 0.05 80)" },
|
||||
};
|
||||
writeFileSync(
|
||||
join(process.env.PI_CODING_AGENT_DIR!, "themes", "custom-export-okhsl.json"),
|
||||
JSON.stringify(customTheme, null, 2),
|
||||
);
|
||||
|
||||
expect(getThemeExportColors("custom-export-okhsl")).toEqual({
|
||||
pageBg: colorToHex(okhslColor(250, 0.2, 0.15)),
|
||||
cardBg: colorToHex(okhslColor(250, 0.2, 0.2)),
|
||||
infoBg: "oklch(30% 0.05 80)",
|
||||
});
|
||||
});
|
||||
|
||||
it("resolves recursive vars and converts 256-color export values to hex", () => {
|
||||
const darkTheme = JSON.parse(
|
||||
readFileSync(new URL("../src/modes/interactive/theme/dark.json", import.meta.url), "utf-8"),
|
||||
|
||||
Reference in New Issue
Block a user