1.0.4 • Published 1 year ago

@miroyar/ccolor v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

cColor pre-alpha(!)


Utility for console text color. Based on 3-bit, 4-bit color chart from Wikipedia.

Description


Method: cColor \ Type:

(text: string, initial: StringColorInitial | ObjectColorInitial) => string;

Type: StringColorInitial \ Description: Has a value from the table of color full initials.

Type: ObjectColorInitial

{
  F?: ColorInitials;
  B?: ColorInitials;
}

Description: An object consisting of two keys F and B, denoting the position of the Foreground and Background colors and having a value from the color initials table.

Table: Colored initials that you can see here.

ColorForegroundBackground
F+B+
BlackD
RedR
GreenG
YellowY
BlueB
MagentaM
CyanC
WhiteW
Bright Black (Gray)BD
Bright RedBR
Bright GreenBG
Bright YellowBY
Bright BlueBB
Bright MagentaBM
Bright CyanBC
Bright WhiteBW

Example:

import { CColor } from '@miroyar/ccolor';

const text = 'The SGR parameters 30–37 selected the foreground color, while 40–47 selected the background.';

const cColor = new CColor();

console.log(cColor.print(text, 'FB'));
console.log(cColor.print(text, 'BBG'));
console.log(cColor.print(text, { F: 'B', B: 'BG' }));
1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago