Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
style(
message: string,
type: ColorType = 'default',
modifiers: ('reset' | 'bold' | 'dim' | 'italic' | 'underline' | 'inverse' | 'hidden')[] = [],
): string {
if (!this.hasColorSupport()) {
return message;
}
const color = this.getColorPalette()[type];
let out = color.charAt(0) === '#' ? style.hex(color) : style[color as Color];
modifiers.forEach(modifier => {
out = out[modifier];
});
return out(message);
}