export const colorText = (() => { const COLOR_SEQUENCE = `\x1b[`; // this is command sequence for display colorized text in terminal const Color = { YELLOW: `33m`, RED: `31m`, GREY: `90m`, GREEN: `32m`, RESET_COLOR: `0m`, } as const; const createColorText = (color: (typeof Color)[keyof typeof Color]) => { return (text: string) => COLOR_SEQUENCE + color + text + COLOR_SEQUENCE + Color.RESET_COLOR; }; return { yellow: createColorText(Color.YELLOW), red: createColorText(Color.RED), grey: createColorText(Color.GREY), green: createColorText(Color.GREEN), default: createColorText(Color.RESET_COLOR), }; })();