UNPKG

jc-color

Version:

A JavaScript tool for color compute and console print tool both for NodeJS and Browser.

106 lines (105 loc) 5.89 kB
import { str } from "@jcstdio/jc-utils"; import type { RgbColorChannels, ColorTextUnit, DisplatMode } from "../types"; declare class TextUnit { private _text; private _foreColor; private _bgColor; private _modes; private _endstyle; private _fontSize; private readonly _default; constructor(text?: string | number, foreColor?: RgbColorChannels | string, bgColor?: RgbColorChannels | string, modes?: Record<DisplatMode, boolean>, endstyle?: boolean); get text(): string; get endstyle(): boolean; remove_color(text?: string): this; remove_bgColor(text?: string, foreColor?: RgbColorChannels | string): this; remove_foreColor(text?: string, bgColor?: RgbColorChannels | string): this; remove_italic(text?: string, foreColor?: RgbColorChannels | string, bgColor?: RgbColorChannels | string): this; remove_bold(text?: string, foreColor?: RgbColorChannels | string, bgColor?: RgbColorChannels | string): this; remove_glimmer(text?: string, foreColor?: RgbColorChannels | string, bgColor?: RgbColorChannels | string): this; reBgColor(bgColor?: RgbColorChannels | string): this; reForeColor(foreColor?: RgbColorChannels | string): this; remove_hidden(text?: string, foreColor?: RgbColorChannels | string, bgColor?: RgbColorChannels | string): this; remove_overline(text?: string, foreColor?: RgbColorChannels | string, bgColor?: RgbColorChannels | string): this; remove_reverse(text?: string, foreColor?: RgbColorChannels | string, bgColor?: RgbColorChannels | string): this; remove_inverseFore(text?: string, foreColor?: RgbColorChannels | string, bgColor?: RgbColorChannels | string): this; remove_inverseBg(text?: string, foreColor?: RgbColorChannels | string, bgColor?: RgbColorChannels | string): this; remove_inverse(text?: string, foreColor?: RgbColorChannels | string, bgColor?: RgbColorChannels | string): this; remove_underline(text?: string, foreColor?: RgbColorChannels | string, bgColor?: RgbColorChannels | string): this; remove_underline_double(text?: string, foreColor?: RgbColorChannels | string, bgColor?: RgbColorChannels | string): this; remove_delete(text?: string, foreColor?: RgbColorChannels | string, bgColor?: RgbColorChannels | string): this; bold(text?: string, foreColor?: RgbColorChannels | string, bgColor?: RgbColorChannels | string): this; reverse(text?: string, foreColor?: RgbColorChannels | string, bgColor?: RgbColorChannels | string): this; inverseFore(text?: string, foreColor?: RgbColorChannels | string, bgColor?: RgbColorChannels | string): this; inverseBg(text?: string, foreColor?: RgbColorChannels | string, bgColor?: RgbColorChannels | string): this; inverse(text?: string, foreColor?: RgbColorChannels | string, bgColor?: RgbColorChannels | string): this; glimmer(text?: string, foreColor?: RgbColorChannels | string, bgColor?: RgbColorChannels | string): this; dark(text?: string, foreColor?: RgbColorChannels | string, bgColor?: RgbColorChannels | string): this; delete(text?: string, foreColor?: RgbColorChannels | string, bgColor?: RgbColorChannels | string): this; hidden(text?: string, foreColor?: RgbColorChannels | string, bgColor?: RgbColorChannels | string): this; italic(text?: string, foreColor?: RgbColorChannels | string, bgColor?: RgbColorChannels | string): this; overline(text?: string, foreColor?: RgbColorChannels | string, bgColor?: RgbColorChannels | string): this; underline(text?: string, foreColor?: RgbColorChannels | string, bgColor?: RgbColorChannels | string): this; underline_double(text?: string, foreColor?: RgbColorChannels | string, bgColor?: RgbColorChannels | string): this; get bgColor(): RgbColorChannels; set bgColor(bgColor: RgbColorChannels | string); get foreColor(): RgbColorChannels; set foreColor(foreColor: RgbColorChannels | string); get size(): number; set size(val: number); get value(): { str: string; background: RgbColorChannels; foreground: RgbColorChannels; size: number; bold: boolean; italic: boolean; delete: boolean; underline: boolean; underline_double: boolean; glimmer: boolean; hidden: boolean; dark: boolean; reverse: boolean; inverseFore: boolean; inverseBg: boolean; }; private styleDescriptor; get modes(): Record<DisplatMode, boolean>; private __str__; print(_str?: string): this; } declare class ColorText extends Array<TextUnit> { constructor(...units: ColorTextUnit[]); private _pushUnit; push(...args: any[]): number; get bgColor(): RgbColorChannels[]; set bgColor(bgColor: (RgbColorChannels | string)[] | RgbColorChannels | string); get foreColor(): RgbColorChannels[]; set foreColor(foreColor: (RgbColorChannels | string)[] | RgbColorChannels | string); add(...units: ColorTextUnit[]): void; private node__str__; print(): this; bold(): this; remove_bold(): this; italic(): this; remove_italic(): this; delete(): this; remove_delete(): this; underline(): this; remove_underline(): this; underline_double(): this; remove_underline_double(): this; glimmer(): this; remove_glimmer(): this; reverse(): this; remove_reverse(): this; inverse(): this; remove_inverse(): this; } declare function gradientText(str: string, foreColors?: (string | RgbColorChannels)[], bgColors?: (string | RgbColorChannels)[]): ColorText; declare function geadientText(str: string, foreColors?: (string | RgbColorChannels)[], bgColors?: (string | RgbColorChannels)[]): ColorText; declare function print(...args: any[]): void; declare function cls(): void; declare function clsLine(): void; export { TextUnit, ColorText, gradientText, geadientText, cls, print, clsLine, str };