Skip to content

Commit 56de9f0

Browse files
committed
Add bright/light colors, closes #128
1 parent b4d964b commit 56de9f0

File tree

9 files changed

+70
-5
lines changed

9 files changed

+70
-5
lines changed

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@ Please check out the [roadmap](ROADMAP.md) for upcoming features and releases.
2929
- gray
3030
- grey
3131

32+
### bright text colors
33+
34+
- brightRed
35+
- brightGreen
36+
- brightYellow
37+
- brightBlue
38+
- brightMagenta
39+
- brightCyan
40+
- brightWhite
41+
3242
### background colors
3343

3444
- bgBlack
@@ -39,6 +49,18 @@ Please check out the [roadmap](ROADMAP.md) for upcoming features and releases.
3949
- bgMagenta
4050
- bgCyan
4151
- bgWhite
52+
- bgGray
53+
- bgGrey
54+
55+
### bright background colors
56+
57+
- bgBrightRed
58+
- bgBrightGreen
59+
- bgBrightYellow
60+
- bgBrightBlue
61+
- bgBrightMagenta
62+
- bgBrightCyan
63+
- bgBrightWhite
4264

4365
### styles
4466

examples/normal-usage.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ console.log('Background color attack!'.black.bgWhite);
2929
console.log('Use random styles on everything!'.random);
3030
console.log('America, Heck Yeah!'.america);
3131

32+
console.log('Blindingly '.brightCyan + 'bright? '.brightRed + 'Why '.brightYellow + 'not?!'.brightGreen);
3233

3334
console.log('Setting themes is useful');
3435

examples/safe-string.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ console.log(colors.black.bgWhite('Background color attack!'));
2828
console.log(colors.random('Use random styles on everything!'));
2929
console.log(colors.america('America, Heck Yeah!'));
3030

31+
console.log(colors.brightCyan('Blindingly ') + colors.brightRed('bright? ') + colors.brightYellow('Why ') + colors.brightGreen('not?!'));
32+
3133
console.log('Setting themes is useful');
3234

3335
//

lib/maps/random.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
module['exports'] = function(colors) {
22
var available = ['underline', 'inverse', 'grey', 'yellow', 'red', 'green',
3-
'blue', 'white', 'cyan', 'magenta'];
3+
'blue', 'white', 'cyan', 'magenta', 'brightYellow', 'brightRed',
4+
'brightGreen', 'brightBlue', 'brightWhite', 'brightCyan', 'brightMagenta'];
45
return function(letter, i, exploded) {
56
return letter === ' ' ? letter :
67
colors[

lib/styles.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ var codes = {
4848
gray: [90, 39],
4949
grey: [90, 39],
5050

51+
brightRed: [91, 39],
52+
brightGreen: [92, 39],
53+
brightYellow: [93, 39],
54+
brightBlue: [94, 39],
55+
brightMagenta: [95, 39],
56+
brightCyan: [96, 39],
57+
brightWhite: [97, 39],
58+
5159
bgBlack: [40, 49],
5260
bgRed: [41, 49],
5361
bgGreen: [42, 49],
@@ -56,6 +64,16 @@ var codes = {
5664
bgMagenta: [45, 49],
5765
bgCyan: [46, 49],
5866
bgWhite: [47, 49],
67+
bgGray: [100, 49],
68+
bgGrey: [100, 49],
69+
70+
bgBrightRed: [101, 49],
71+
bgBrightGreen: [102, 49],
72+
bgBrightYellow: [103, 49],
73+
bgBrightBlue: [104, 49],
74+
bgBrightMagenta: [105, 49],
75+
bgBrightCyan: [106, 49],
76+
bgBrightWhite: [107, 49],
5977

6078
// legacy styles for colors pre v1.0.0
6179
blackBG: [40, 49],

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "colors",
33
"description": "get colors in your node.js console",
4-
"version": "1.3.4",
4+
"version": "1.4.0",
55
"author": "Marak Squires",
66
"contributors": [
77
{

tests/basic-test.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ function aE(s, color, code) {
1616
}
1717

1818
var stylesColors = ['white', 'black', 'blue', 'cyan', 'green', 'magenta',
19-
'red', 'yellow'];
19+
'red', 'yellow', 'brightYellow', 'brightRed',
20+
'brightGreen', 'brightBlue', 'brightWhite', 'brightCyan',
21+
'brightMagenta'];
22+
2023
// eslint-disable-next-line
2124
var stylesAll = stylesColors.concat(['bold', 'italic', 'underline',
2225
'inverse', 'rainbow']);
@@ -46,6 +49,14 @@ aE(s, 'magenta', 35);
4649
aE(s, 'red', 31);
4750
aE(s, 'yellow', 33);
4851

52+
aE(s, 'brightWhite', 97);
53+
aE(s, 'brightBlue', 94);
54+
aE(s, 'brightCyan', 96);
55+
aE(s, 'brightGreen', 92);
56+
aE(s, 'brightMagenta', 95);
57+
aE(s, 'brightRed', 91);
58+
aE(s, 'brightYellow', 93);
59+
4960
assert.equal(s, 'string');
5061

5162
var testStringWithNewLines = s + '\n' + s;

tests/safe-test.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ function aE(s, color, code) {
1313
}
1414

1515
var stylesColors = ['white', 'black', 'blue', 'cyan', 'green', 'magenta',
16-
'red', 'yellow'];
16+
'red', 'yellow', 'brightYellow', 'brightRed',
17+
'brightGreen', 'brightBlue', 'brightWhite', 'brightCyan',
18+
'brightMagenta'];
1719
// eslint-disable-next-line
1820
var stylesAll = stylesColors.concat(['bold', 'italic', 'underline', 'inverse',
1921
'rainbow']);
@@ -37,6 +39,14 @@ aE(s, 'magenta', 35);
3739
aE(s, 'red', 31);
3840
aE(s, 'yellow', 33);
3941

42+
aE(s, 'brightWhite', 97);
43+
aE(s, 'brightBlue', 94);
44+
aE(s, 'brightCyan', 96);
45+
aE(s, 'brightGreen', 92);
46+
aE(s, 'brightMagenta', 95);
47+
aE(s, 'brightRed', 91);
48+
aE(s, 'brightYellow', 93);
49+
4050
assert.equal(s, 'string');
4151

4252
var testStringWithNewLines = s + '\n' + s;

0 commit comments

Comments
 (0)