mirror of
https://github.com/lc-soft/LCUI.git
synced 2026-11-30 16:48:21 +01:00
- share shadcn neutral color tokens between both Tailwind configs - rewrite Tailwind dark selectors into LCUI-compatible descendant selectors - theme style-nova components and doc-viewer surfaces for dark mode - generate GitHub Light and GitHub Dark syntax line pairs for code blocks - support alpha channels in text style tag colors - keep focus rings and scrollbars visible on dark surfaces - use a neutral code surface instead of GitHub's blue-tinted background
50 lines
1.3 KiB
JavaScript
50 lines
1.3 KiB
JavaScript
const fs = require("node:fs");
|
|
const path = require("node:path");
|
|
|
|
const root = path.resolve(__dirname, "..");
|
|
const sourceFiles = [
|
|
"src/styles/style-nova.css",
|
|
"examples/doc-viewer/app/global.css",
|
|
"examples/doc-viewer/app/components/navbar.css",
|
|
];
|
|
const generatedFiles = [
|
|
"src/styles/style-nova.css.h",
|
|
"examples/doc-viewer/app/global.css.h",
|
|
];
|
|
|
|
const colorPattern = /#[0-9a-fA-F]{3,8}\b|rgba?\(/g;
|
|
let failed = false;
|
|
|
|
for (const relative of sourceFiles) {
|
|
const file = path.join(root, relative);
|
|
if (!fs.existsSync(file)) {
|
|
continue;
|
|
}
|
|
const lines = fs.readFileSync(file, "utf8").split(/\r?\n/);
|
|
lines.forEach((line, index) => {
|
|
if (colorPattern.test(line)) {
|
|
failed = true;
|
|
console.error(`${relative}:${index + 1}: raw color literal: ${line.trim()}`);
|
|
}
|
|
colorPattern.lastIndex = 0;
|
|
});
|
|
}
|
|
|
|
for (const relative of generatedFiles) {
|
|
const file = path.join(root, relative);
|
|
if (!fs.existsSync(file)) {
|
|
continue;
|
|
}
|
|
const text = fs.readFileSync(file, "utf8");
|
|
if (text.includes(":is(.dark") || text.includes(":where(.dark")) {
|
|
failed = true;
|
|
console.error(`${relative}: contains an unsupported dark selector`);
|
|
}
|
|
}
|
|
|
|
if (failed) {
|
|
process.exitCode = 1;
|
|
} else {
|
|
console.log("theme css checks passed");
|
|
}
|