diff --git a/index.d.ts b/index.d.ts index db72fab..faa9ab6 100644 --- a/index.d.ts +++ b/index.d.ts @@ -46,6 +46,8 @@ export interface Color { zalgo: Color; } +export function enable(): void; +export function disable(): void; export function setTheme(theme: any): void; export let enabled: boolean; diff --git a/lib/colors.js b/lib/colors.js index 8de48e2..2854154 100644 --- a/lib/colors.js +++ b/lib/colors.js @@ -43,6 +43,14 @@ if (typeof colors.enabled === "undefined") { colors.enabled = colors.supportsColor() !== false; } +colors.enable = function () { + colors.enabled = true; +}; + +colors.disable = function () { + colors.enabled = false; +}; + colors.stripColors = colors.strip = function(str){ return ("" + str).replace(/\x1B\[\d+m/g, ''); }; diff --git a/safe.d.ts b/safe.d.ts index 87f5ef2..2bafc27 100644 --- a/safe.d.ts +++ b/safe.d.ts @@ -4,6 +4,9 @@ // Definitions: https://github.com/Marak/colors.js export const enabled: boolean; +export function enable(): void; +export function disable(): void; +export function setTheme(theme: any): void; export function strip(str: string): string; export function stripColors(str: string): string;