Skip to content

Commit

Permalink
[colors_v1.3.x] Allow nested style modifiers (#3374)
Browse files Browse the repository at this point in the history
  • Loading branch information
atabel authored and pascalduez committed Jun 7, 2019
1 parent be5c3bb commit bedeb81
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 38 deletions.
119 changes: 81 additions & 38 deletions definitions/npm/colors_v1.3.x/flow_all/colors_v1.3.x.js
@@ -1,49 +1,92 @@
declare module "colors" {
declare type Color = {
(text: string): string,

strip: Color,
stripColors: Color,

black: Color,
red: Color,
green: Color,
yellow: Color,
blue: Color,
magenta: Color,
cyan: Color,
white: Color,
gray: Color,
grey: Color,

bgBlack: Color,
bgRed: Color,
bgGreen: Color,
bgYellow: Color,
bgBlue: Color,
bgMagenta: Color,
bgCyan: Color,
bgWhite: Color,

reset: Color,
bold: Color,
dim: Color,
italic: Color,
underline: Color,
inverse: Color,
hidden: Color,
strikethrough: Color,

rainbow: Color,
zebra: Color,
america: Color,
trap: Color,
random: Color,
zalgo: Color,
};

declare module.exports: {
enabled: boolean,
themes: {},
enable(): void,
disable(): void,
setTheme(theme: {}): void,

strip(str: string): string,
stripColors(str: string): string,

black(str: string): string,
red(str: string): string,
green(str: string): string,
yellow(str: string): string,
blue(str: string): string,
magenta(str: string): string,
cyan(str: string): string,
white(str: string): string,
gray(str: string): string,
grey(str: string): string,

bgBlack(str: string): string,
bgRed(str: string): string,
bgGreen(str: string): string,
bgYellow(str: string): string,
bgBlue(str: string): string,
bgMagenta(str: string): string,
bgCyan(str: string): string,
bgWhite(str: string): string,

reset(str: string): string,
bold(str: string): string,
dim(str: string): string,
italic(str: string): string,
underline(str: string): string,
inverse(str: string): string,
hidden(str: string): string,
strikethrough(str: string): string,

rainbow(str: string): string,
zebra(str: string): string,
america(str: string): string,
trap(str: string): string,
random(str: string): string,
zalgo(str: string): string
strip: Color,
stripColors: Color,

black: Color,
red: Color,
green: Color,
yellow: Color,
blue: Color,
magenta: Color,
cyan: Color,
white: Color,
gray: Color,
grey: Color,

bgBlack: Color,
bgRed: Color,
bgGreen: Color,
bgYellow: Color,
bgBlue: Color,
bgMagenta: Color,
bgCyan: Color,
bgWhite: Color,

reset: Color,
bold: Color,
dim: Color,
italic: Color,
underline: Color,
inverse: Color,
hidden: Color,
strikethrough: Color,

rainbow: Color,
zebra: Color,
america: Color,
trap: Color,
random: Color,
zalgo: Color,
};
}

Expand Down
7 changes: 7 additions & 0 deletions definitions/npm/colors_v1.3.x/test_colors_v1.3.x.js
Expand Up @@ -547,4 +547,11 @@ describe("The `colors` safe API", () => {
(colors.zalgo(""): void);
});
});

describe("Colors", () => {
it("should allow nested style modifiers", () => {
colors.red.bold("");
colors.bold.red("");
});
});
});

0 comments on commit bedeb81

Please sign in to comment.