everything-dev
Version:
A consolidated product package for building Module Federation apps with oRPC APIs.
63 lines (61 loc) • 1.69 kB
JavaScript
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
let chalk = require("chalk");
chalk = require_runtime.__toESM(chalk, 1);
//#region src/utils/theme.ts
const hex = (code) => (text) => chalk.default.hex(code)(text);
const truecolorRamp = (from, to) => (text) => {
const rgb = (code) => [
1,
3,
5
].map((i) => parseInt(code.slice(i, i + 2), 16));
const [r1 = 0, g1 = 0, b1 = 0] = rgb(from);
const [r2 = 0, g2 = 0, b2 = 0] = rgb(to);
const chars = Array.from(text);
const total = chars.filter((ch) => ch !== "\n").length;
let seen = 0;
return chars.map((ch) => {
if (ch === "\n") return ch;
const t = total > 1 ? seen / (total - 1) : 0;
seen += 1;
return chalk.default.rgb(Math.round(r1 + (r2 - r1) * t), Math.round(g1 + (g2 - g1) * t), Math.round(b1 + (b2 - b1) * t))(ch);
}).join("");
};
const gradients = { cyber: truecolorRamp("#00ffff", "#ff00ff") };
const colors = {
cyan: hex("#00ffff"),
magenta: hex("#ff00ff"),
green: hex("#00ff41"),
blue: hex("#0080ff"),
yellow: hex("#ffcc00"),
orange: hex("#ffaa00"),
white: hex("#f0f0f0"),
gray: hex("#555555"),
dim: chalk.default.dim,
error: hex("#ff3366")
};
const icons = {
scan: "○",
run: "▶",
ok: "✓",
err: "✗",
pending: "○",
arrow: "→",
dot: "·",
app: "◉",
config: "⚙"
};
const frames = {
top: (width) => `┌${"─".repeat(width - 2)}┐`,
bottom: (width) => `└${"─".repeat(width - 2)}┘`
};
function divider(width = 48) {
return chalk.default.dim("─".repeat(width));
}
//#endregion
exports.colors = colors;
exports.divider = divider;
exports.frames = frames;
exports.gradients = gradients;
exports.icons = icons;
//# sourceMappingURL=theme.cjs.map