-
-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(types): extract
kleur/colors
definitions
- Loading branch information
Showing
2 changed files
with
77 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
declare function print(input: string | boolean | number): string; | ||
declare function print(input: undefined | void): undefined; | ||
declare function print(input: null): null; | ||
type Colorize = typeof print; | ||
|
||
export declare const $: { enabled: boolean }; | ||
|
||
// Colors | ||
export declare const black: Colorize; | ||
export declare const red: Colorize; | ||
export declare const green: Colorize; | ||
export declare const yellow: Colorize; | ||
export declare const blue: Colorize; | ||
export declare const magenta: Colorize; | ||
export declare const cyan: Colorize; | ||
export declare const white: Colorize; | ||
export declare const gray: Colorize; | ||
export declare const grey: Colorize; | ||
|
||
// Backgrounds | ||
export declare const bgBlack: Colorize; | ||
export declare const bgRed: Colorize; | ||
export declare const bgGreen: Colorize; | ||
export declare const bgYellow: Colorize; | ||
export declare const bgBlue: Colorize; | ||
export declare const bgMagenta: Colorize; | ||
export declare const bgCyan: Colorize; | ||
export declare const bgWhite: Colorize; | ||
|
||
// Modifiers | ||
export declare const reset: Colorize; | ||
export declare const bold: Colorize; | ||
export declare const dim: Colorize; | ||
export declare const italic: Colorize; | ||
export declare const underline: Colorize; | ||
export declare const inverse: Colorize; | ||
export declare const hidden: Colorize; | ||
export declare const strikethrough: Colorize; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,98 +1,45 @@ | ||
// Originally by: Rogier Schouten <https://github.com/rogierschouten> | ||
// Adapted by: Madhav Varshney <https://github.com/madhavarshney> | ||
declare module 'kleur' { | ||
namespace kleur { | ||
interface Color { | ||
(x: string | number): string; | ||
(): Kleur; | ||
} | ||
|
||
interface Kleur { | ||
// Colors | ||
black: Color; | ||
red: Color; | ||
green: Color; | ||
yellow: Color; | ||
blue: Color; | ||
magenta: Color; | ||
cyan: Color; | ||
white: Color; | ||
gray: Color; | ||
grey: Color; | ||
|
||
// Backgrounds | ||
bgBlack: Color; | ||
bgRed: Color; | ||
bgGreen: Color; | ||
bgYellow: Color; | ||
bgBlue: Color; | ||
bgMagenta: Color; | ||
bgCyan: Color; | ||
bgWhite: Color; | ||
|
||
// Modifiers | ||
reset: Color; | ||
bold: Color; | ||
dim: Color; | ||
italic: Color; | ||
underline: Color; | ||
inverse: Color; | ||
hidden: Color; | ||
strikethrough: Color; | ||
} | ||
declare namespace kleur { | ||
interface Color { | ||
(x: string | number): string; | ||
(): Kleur; | ||
} | ||
|
||
let kleur: kleur.Kleur & { enabled: boolean }; | ||
export = kleur; | ||
} | ||
|
||
declare module 'kleur/colors' { | ||
function print(input: string | boolean | number): string; | ||
function print(input: undefined | void): undefined; | ||
function print(input: null): null; | ||
type Colorize = typeof print; | ||
|
||
namespace kleur { | ||
interface Context { | ||
enabled: boolean; | ||
} | ||
|
||
interface Kleur { | ||
// Colors | ||
black: Colorize; | ||
red: Colorize; | ||
green: Colorize; | ||
yellow: Colorize; | ||
blue: Colorize; | ||
magenta: Colorize; | ||
cyan: Colorize; | ||
white: Colorize; | ||
gray: Colorize; | ||
grey: Colorize; | ||
|
||
// Backgrounds | ||
bgBlack: Colorize; | ||
bgRed: Colorize; | ||
bgGreen: Colorize; | ||
bgYellow: Colorize; | ||
bgBlue: Colorize; | ||
bgMagenta: Colorize; | ||
bgCyan: Colorize; | ||
bgWhite: Colorize; | ||
|
||
// Modifiers | ||
reset: Colorize; | ||
bold: Colorize; | ||
dim: Colorize; | ||
italic: Colorize; | ||
underline: Colorize; | ||
inverse: Colorize; | ||
hidden: Colorize; | ||
strikethrough: Colorize; | ||
} | ||
interface Kleur { | ||
// Colors | ||
black: Color; | ||
red: Color; | ||
green: Color; | ||
yellow: Color; | ||
blue: Color; | ||
magenta: Color; | ||
cyan: Color; | ||
white: Color; | ||
gray: Color; | ||
grey: Color; | ||
|
||
// Backgrounds | ||
bgBlack: Color; | ||
bgRed: Color; | ||
bgGreen: Color; | ||
bgYellow: Color; | ||
bgBlue: Color; | ||
bgMagenta: Color; | ||
bgCyan: Color; | ||
bgWhite: Color; | ||
|
||
// Modifiers | ||
reset: Color; | ||
bold: Color; | ||
dim: Color; | ||
italic: Color; | ||
underline: Color; | ||
inverse: Color; | ||
hidden: Color; | ||
strikethrough: Color; | ||
} | ||
|
||
|
||
let kleur: kleur.Kleur & { $: kleur.Context }; | ||
export = kleur; | ||
} | ||
|
||
declare let kleur: kleur.Kleur & { enabled: boolean }; | ||
export = kleur; |