Skip to content

Commit 55bc9e1

Browse files
committed
Color
0 parents  commit 55bc9e1

35 files changed

+11197
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
playground
2+
playerground
3+
**/node_modules

.vscode/settings.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"editor.inlineSuggest.enabled": true,
3+
"editor.quickSuggestions": {
4+
"other": "inline",
5+
"comments": true,
6+
"strings": true
7+
},
8+
"editor.quickSuggestionsDelay": 100
9+
}

README.md

Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
# ChalkBox
2+
> one of the best colors modules out there.
3+
it does not extend string prototype and is 10x engineered. it uses commonjs and not esm.
4+
5+
## get color and style in your node.js console
6+
(which is cool)
7+
![Demo](https://raw.githubusercontent.com/tj-commits/chalkbox/master/screenshots/colors.png)
8+
9+
## Installation
10+
11+
npm install chalkbox
12+
13+
## colors and styles!
14+
15+
### text colors
16+
17+
- black
18+
- red
19+
- green
20+
- yellow
21+
- blue
22+
- magenta
23+
- cyan
24+
- white
25+
- gray
26+
- grey
27+
28+
### bright text colors
29+
30+
- brightRed
31+
- brightGreen
32+
- brightYellow
33+
- brightBlue
34+
- brightMagenta
35+
- brightCyan
36+
- brightWhite
37+
38+
### background colors
39+
40+
- bgBlack
41+
- bgRed
42+
- bgGreen
43+
- bgYellow
44+
- bgBlue
45+
- bgMagenta
46+
- bgCyan
47+
- bgWhite
48+
- bgGray
49+
- bgGrey
50+
51+
### bright background colors
52+
53+
- bgBrightRed
54+
- bgBrightGreen
55+
- bgBrightYellow
56+
- bgBrightBlue
57+
- bgBrightMagenta
58+
- bgBrightCyan
59+
- bgBrightWhite
60+
61+
### styles
62+
63+
- reset
64+
- bold
65+
- dim
66+
- italic
67+
- underline
68+
- inverse
69+
- hidden
70+
- strikethrough
71+
72+
### extras
73+
74+
- rainbow
75+
- zebra
76+
- america
77+
- trap
78+
- random
79+
80+
## Usage
81+
82+
```js
83+
const chalkbox = require('chalkbox');
84+
const log = require('logtoconsole').log;
85+
86+
log(chalkbox.green('hello')); // outputs green text
87+
log(chalkbox.red.underline('i like cake and pies')); // outputs red underlined text
88+
log(chalkbox.inverse('inverse the color')); // inverses the color
89+
log(chalkbox.rainbow('OMG Rainbows!')); // rainbow
90+
log(chalkbox.trap('Run the trap')); // Drops the bass
91+
92+
```
93+
94+
## Enabling/Disabling Colors
95+
96+
The package will auto-detect whether your terminal can use colors and enable/disable accordingly. When colors are disabled, the color functions do nothing. You can override this with a command-line flag:
97+
98+
```bash
99+
node myapp.js --no-color
100+
node myapp.js --color=false
101+
102+
node myapp.js --color
103+
node myapp.js --color=true
104+
node myapp.js --color=always
105+
106+
FORCE_COLOR=1 node myapp.js
107+
```
108+
109+
Or in code:
110+
111+
```javascript
112+
var chalkbox = require('chalkbox');
113+
chalkbox.enable();
114+
chalkbox.disable();
115+
```
116+
117+
## Custom themes
118+
119+
```js
120+
var chalkbox = require('chalkbox');
121+
var log = require('logtoconsole').log;
122+
123+
// set single property
124+
var error = chalkbox.red;
125+
error('this is red');
126+
127+
// set theme
128+
chalkbox.setTheme({
129+
silly: 'rainbow',
130+
input: 'grey',
131+
verbose: 'cyan',
132+
prompt: 'grey',
133+
info: 'green',
134+
data: 'grey',
135+
help: 'cyan',
136+
warn: 'yellow',
137+
debug: 'blue',
138+
error: 'red'
139+
});
140+
141+
// outputs red text
142+
log(chalkbox.error("this is an error"));
143+
144+
// outputs yellow text
145+
log(chalkbox.warn("this is a warning"));
146+
147+
```
148+
149+
### Combining Colors
150+
151+
```javascript
152+
var chalkbox = require('chalkbox');
153+
154+
chalkbox.setTheme({
155+
custom: ['red', 'underline']
156+
});
157+
158+
console.log(chalkbox.custom('test'));
159+
```
160+
161+
*Protip: There is a secret undocumented style in `chalkbox`. If you find the style you can summon him.*

packages/chalkbox/README.md

Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
# ChalkBox
2+
> one of the best colors modules out there.
3+
it does not extend string prototype and is 10x engineered. it uses commonjs and not esm.
4+
5+
## get color and style in your node.js console
6+
(which is cool)
7+
![Demo](https://raw.githubusercontent.com/tj-commits/chalkbox/master/screenshots/colors.png)
8+
9+
## Installation
10+
11+
npm install chalkbox
12+
13+
## colors and styles!
14+
15+
### text colors
16+
17+
- black
18+
- red
19+
- green
20+
- yellow
21+
- blue
22+
- magenta
23+
- cyan
24+
- white
25+
- gray
26+
- grey
27+
28+
### bright text colors
29+
30+
- brightRed
31+
- brightGreen
32+
- brightYellow
33+
- brightBlue
34+
- brightMagenta
35+
- brightCyan
36+
- brightWhite
37+
38+
### background colors
39+
40+
- bgBlack
41+
- bgRed
42+
- bgGreen
43+
- bgYellow
44+
- bgBlue
45+
- bgMagenta
46+
- bgCyan
47+
- bgWhite
48+
- bgGray
49+
- bgGrey
50+
51+
### bright background colors
52+
53+
- bgBrightRed
54+
- bgBrightGreen
55+
- bgBrightYellow
56+
- bgBrightBlue
57+
- bgBrightMagenta
58+
- bgBrightCyan
59+
- bgBrightWhite
60+
61+
### styles
62+
63+
- reset
64+
- bold
65+
- dim
66+
- italic
67+
- underline
68+
- inverse
69+
- hidden
70+
- strikethrough
71+
72+
### extras
73+
74+
- rainbow
75+
- zebra
76+
- america
77+
- trap
78+
- random
79+
80+
## Usage
81+
82+
```js
83+
const chalkbox = require('chalkbox');
84+
const log = require('logtoconsole').log;
85+
86+
log(chalkbox.green('hello')); // outputs green text
87+
log(chalkbox.red.underline('i like cake and pies')); // outputs red underlined text
88+
log(chalkbox.inverse('inverse the color')); // inverses the color
89+
log(chalkbox.rainbow('OMG Rainbows!')); // rainbow
90+
log(chalkbox.trap('Run the trap')); // Drops the bass
91+
92+
```
93+
94+
## Enabling/Disabling Colors
95+
96+
The package will auto-detect whether your terminal can use colors and enable/disable accordingly. When colors are disabled, the color functions do nothing. You can override this with a command-line flag:
97+
98+
```bash
99+
node myapp.js --no-color
100+
node myapp.js --color=false
101+
102+
node myapp.js --color
103+
node myapp.js --color=true
104+
node myapp.js --color=always
105+
106+
FORCE_COLOR=1 node myapp.js
107+
```
108+
109+
Or in code:
110+
111+
```javascript
112+
var chalkbox = require('chalkbox');
113+
chalkbox.enable();
114+
chalkbox.disable();
115+
```
116+
117+
## Custom themes
118+
119+
```js
120+
var chalkbox = require('chalkbox');
121+
var log = require('logtoconsole').log;
122+
123+
// set single property
124+
var error = chalkbox.red;
125+
error('this is red');
126+
127+
// set theme
128+
chalkbox.setTheme({
129+
silly: 'rainbow',
130+
input: 'grey',
131+
verbose: 'cyan',
132+
prompt: 'grey',
133+
info: 'green',
134+
data: 'grey',
135+
help: 'cyan',
136+
warn: 'yellow',
137+
debug: 'blue',
138+
error: 'red'
139+
});
140+
141+
// outputs red text
142+
log(chalkbox.error("this is an error"));
143+
144+
// outputs yellow text
145+
log(chalkbox.warn("this is a warning"));
146+
147+
```
148+
149+
### Combining Colors
150+
151+
```javascript
152+
var chalkbox = require('chalkbox');
153+
154+
chalkbox.setTheme({
155+
custom: ['red', 'underline']
156+
});
157+
158+
console.log(chalkbox.custom('test'));
159+
```
160+
161+
*Protip: There is a secret undocumented style in `chalkbox`. If you find the style you can summon him.*

0 commit comments

Comments
 (0)