const colorMap = {
  purple: "\x1b[35m",
  porple: "\x1b[38;2;150;0;200m",
  red: "\x1b[31m",
  green: "\x1b[32m",
  yellow: "\x1b[33m",
  blue: "\x1b[34m",
  cyan: "\x1b[36m",
  white: "\x1b[37m",
  gray: "\x1b[90m",
  get grey() {
    return this.gray;
  },
};

export function colorize(text: string, color?: keyof typeof colorMap | string) {
  if (!color) return text;
  const c = colorMap[color as keyof typeof colorMap];
  if (!c) return text;
  return `${c}${text}\x1b[0m`;
}
