This commit is contained in:
katsanva 2019-05-15 18:48:30 +03:00 committed by Nathan Shively-Sanders
parent a36a951bda
commit 803b822ff3
3 changed files with 45 additions and 17 deletions

View File

@ -37,13 +37,13 @@ declare namespace Terminal {
brightMagenta: CTerminal;
brightCyan: CTerminal;
brightWhite: CTerminal;
color: (register: number) => Terminal;
darkColor: (register: number) => Terminal;
brightColor: (register: number) => Terminal;
color256: (register: number) => Terminal;
colorRgb: (r: number, g: number, b: number) => Terminal;
colorRgbHex: (rgb: string) => Terminal;
colorGrayscale: (I: number) => Terminal;
color: (color: number | string, str?: string) => Terminal;
darkColor: (color: number | string, str?: string) => Terminal;
brightColor: (color: number | string, str?: string) => Terminal;
color256: (color: number | string, str?: string) => Terminal;
colorRgb: (r: number, g: number, b: number, str?: string) => Terminal;
colorRgbHex: (rgb: string, str?: string) => Terminal;
colorGrayscale: (I: number, str?: string) => Terminal;
bgDefaultColor: CTerminal;
bgBlack: CTerminal;
@ -64,13 +64,13 @@ declare namespace Terminal {
bgBrightMagenta: CTerminal;
bgBrightCyan: CTerminal;
bgBrightWhite: CTerminal;
bgColor: (register: number) => Terminal;
bgDarkColor: (register: number) => Terminal;
bgBrightColor: (register: number) => Terminal;
bgColor256: (register: number) => Terminal;
bgColorRgb: (r: number, g: number, b: number) => Terminal;
bgColorRgbHex: (rgb: string) => Terminal;
bgColorGrayscale: (I: number) => Terminal;
bgColor: (color: number | string, str?: string) => Terminal;
bgDarkColor: (color: number | string, str?: string) => Terminal;
bgBrightColor: (color: number | string, str?: string) => Terminal;
bgColor256: (color: number | string, str?: string) => Terminal;
bgColorRgb: (r: number, g: number, b: number, str?: string) => Terminal;
bgColorRgbHex: (rgb: string, str?: string) => Terminal;
bgColorGrayscale: (I: number, str?: string) => Terminal;
styleReset: CTerminal;
bold: CTerminal;
@ -142,8 +142,8 @@ declare namespace Terminal {
error: Terminal;
str: Terminal;
noFormat: (str: string) => Terminal;
markupOnly: (str: string) => Terminal;
noFormat: CTerminal;
markupOnly: CTerminal;
wrap: CTerminal;
bindArgs: (...args: any[]) => Terminal;

View File

@ -1,4 +1,4 @@
// Type definitions for terminal-kit 1.26
// Type definitions for terminal-kit 1.28
// Project: https://github.com/cronvel/terminal-kit#readme
// Definitions by: katsanva <https://github.com/katsanva>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

View File

@ -409,6 +409,34 @@ term("My name is ")
.green("32\n");
term("My name is ^rJack^ and I'm ^g32\n");
term.noFormat.red("hello");
term.noFormat("hello");
// color methods with a second argument
term.color(1, "test");
term.darkColor(1, "test");
term.brightColor(1, "test");
term.color256(1, "test");
term.colorRgb(255, 0, 0, "test");
term.colorRgbHex("#ff0000", "test");
term.colorGrayscale(192, "test");
// bgColor methods with a second argument
term.bgColor(1, "test");
term.bgDarkColor(1, "test");
term.bgBrightColor(1, "test");
term.bgColor256(1, "test");
term.bgColorRgb(255, 0, 0, "test");
term.bgColorRgbHex("#ff0000", "test");
term.bgColorGrayscale(192, "test");
// new color & bgColor with color name
term.color("red");
term.color("red", "test");
term.bgColor("red");
term.bgColor("red", "test");
getDetectedTerminal((error: any, term: any) => {
term.cyan("Terminal name: %s\n", term.appName);
term.cyan("Terminal app: %s\n", term.app);