// ANSI color codes
export const colors = {
reset: "\x1b[0m",
green: "\x1b[32m",
blue: "\x1b[34m",
yellow: "\x1b[33m",
red: "\x1b[31m",
cyan: "\x1b[36m",
gray: "\x1b[90m",
magenta: "\x1b[35m",
} as const;
export type ColorName = keyof typeof colors;
export function colorize(text: string, color: ColorName): string {
return `${colors[color]}${text}${colors.reset}`;
}
export function success(message: string): void {
console.log(colorize(`✓ ${message}`, "green"));
}
export function info(message: string): void {
console.log(colorize(`ℹ ${message}`, "cyan"));
}
export function warn(message: string): void {
console.log(colorize(`⚠ ${message}`, "yellow"));
}
export function error(message: string): void {
console.error(colorize(`✗ ${message}`, "red"));
}
export function log(message: string, color: ColorName = "reset"): void {
console.log(colorize(message, color));
}