8colors 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -17,7 +17,7 @@ npm install --save 8colors
17
17
  #### Example
18
18
 
19
19
  ```javascript
20
- const c = require('./index')
20
+ const c = require('8colors')
21
21
 
22
22
  var title ='WARNING'
23
23
 
package/index.d.ts ADDED
@@ -0,0 +1,71 @@
1
+ declare module '8colors' {
2
+ interface EightColors {
3
+ store: string;
4
+
5
+ // Direct color methods
6
+ black(str: string): string;
7
+ red(str: string): string;
8
+ green(str: string): string;
9
+ yellow(str: string): string;
10
+ blue(str: string): string;
11
+ magenta(str: string): string;
12
+ cyan(str: string): string;
13
+ white(str: string): string;
14
+
15
+ // Chainable foreground standard
16
+ k(str: string): this;
17
+ r(str: string): this;
18
+ g(str: string): this;
19
+ y(str: string): this;
20
+ b(str: string): this;
21
+ m(str: string): this;
22
+ c(str: string): this;
23
+ w(str: string): this;
24
+
25
+ // Chainable foreground bright
26
+ bk(str: string): this;
27
+ br(str: string): this;
28
+ bg(str: string): this;
29
+ by(str: string): this;
30
+ bb(str: string): this;
31
+ bm(str: string): this;
32
+ bc(str: string): this;
33
+ bw(str: string): this;
34
+
35
+ // Chainable background standard
36
+ K(): this;
37
+ R(): this;
38
+ G(): this;
39
+ Y(): this;
40
+ B(): this;
41
+ M(): this;
42
+ C(): this;
43
+ W(): this;
44
+
45
+ // Chainable background bright
46
+ BK(): this; // Note: You have two BB's in your code, I've renamed bright_bg_black to BK
47
+ BR(): this;
48
+ BG(): this;
49
+ BY(): this;
50
+ BB(): this;
51
+ BM(): this;
52
+ BC(): this;
53
+ BW(): this;
54
+
55
+ // Chainable styles
56
+ V(): this;
57
+ _(): this;
58
+ reset(): this;
59
+ I(): this;
60
+ blk(): this;
61
+ rblk(): this;
62
+
63
+ /**
64
+ * Returns the final styled string and resets the internal store.
65
+ */
66
+ end(): string;
67
+ }
68
+
69
+ const eightColors: EightColors;
70
+ export = eightColors;
71
+ }
package/index.js CHANGED
@@ -1,147 +1,147 @@
1
- `use strict`
2
-
3
- const colors = {
4
- //style
5
- "reset" : "\033[0m",
6
- "intense" : "\033[1m",
7
- "underline" : "\033[4m",
8
- "inverse" : "\033[7m",
9
- "slow_blink": "\033[5m",
10
- "rapid_blink": "\033[6m",
11
- // foreground colors STANDARD
12
- "black" : "\033[30m",
13
- "red" : "\033[31m",
14
- "green" : "\033[32m",
15
- "yellow" : "\033[33m",
16
- "blue" : "\033[34m",
17
- "magenta" : "\033[35m",
18
- "cyan" : "\033[36m",
19
- "white" : "\033[37m",
20
- // foreground colors BRIGHT
21
- "bright_black" : "\033[90m",
22
- "bright_red" : "\033[91m",
23
- "bright_green" : "\033[92m",
24
- "bright_yellow" : "\033[93m",
25
- "bright_blue" : "\033[94m",
26
- "bright_magenta" : "\033[95m",
27
- "bright_cyan" : "\033[96m",
28
- "bright_white" : "\033[97m",
29
- // background colors STANDARD
30
- "bg_black" : "\033[40m",
31
- "bg_red" : "\033[41m",
32
- "bg_green" : "\033[42m",
33
- "bg_yellow" : "\033[43m",
34
- "bg_blue" : "\033[44m",
35
- "bg_magenta" : "\033[45m",
36
- "bg_cyan" : "\033[46m",
37
- "bg_white" : "\033[47m",
38
- // background colors BRIGHT
39
- "bright_bg_black" : "\033[100m",
40
- "bright_bg_red" : "\033[101m",
41
- "bright_bg_green" : "\033[102m",
42
- "bright_bg_yellow" : "\033[103m",
43
- "bright_bg_blue" : "\033[104m",
44
- "bright_bg_magenta" : "\033[105m",
45
- "bright_bg_cyan" : "\033[106m",
46
- "bright_bg_white" : "\033[107m"
47
- }
48
-
49
-
50
- module.exports = {
51
- store: '',
52
- black : function(str) {return colors['black'] + str + colors['reset']},
53
- red : function(str) {return colors['red'] + str + colors['reset']},
54
- green : function(str) {return colors['green'] + str + colors['reset']},
55
- yellow : function(str) {return colors['yellow'] + str + colors['reset']},
56
- blue : function(str) {return colors['blue'] + str + colors['reset']},
57
- magenta : function(str) {return colors['magenta'] + str + colors['reset']},
58
- cyan : function(str) {return colors['cyan'] + str + colors['reset']},
59
- white : function(str) {return colors['white'] + str + colors['reset']},
60
- //shorthand Foreground STANDARD
61
- k : function(str) {this.store += colors['black'] + str + colors['reset']
62
- return this},
63
- r : function(str) {this.store += colors['red'] + str + colors['reset']
64
- return this},
65
- g : function(str) {this.store += colors['green'] + str + colors['reset']
66
- return this},
67
- y : function(str) {this.store += colors['yellow'] + str + colors['reset']
68
- return this},
69
- b : function(str) {this.store += colors['blue'] + str + colors['reset']
70
- return this},
71
- m : function(str) {this.store += colors['magenta'] + str + colors['reset']
72
- return this},
73
- c : function(str) {this.store += colors['cyan'] + str + colors['reset']
74
- return this},
75
- w : function(str) {this.store += colors['white'] + str + colors['reset']
76
- return this },
77
- //shorthand Foreground BRIGHT
78
- bk : function(str) {this.store += colors['bright_black'] + str + colors['reset']
79
- return this},
80
- br : function(str) {this.store += colors['bright_red'] + str + colors['reset']
81
- return this},
82
- bg : function(str) {this.store += colors['bright_green'] + str + colors['reset']
83
- return this},
84
- by : function(str) {this.store += colors['bright_yellow'] + str + colors['reset']
85
- return this},
86
- bb : function(str) {this.store += colors['bright_blue'] + str + colors['reset']
87
- return this},
88
- bm : function(str) {this.store += colors['bright_magenta'] + str + colors['reset']
89
- return this},
90
- bc : function(str) {this.store += colors['bright_cyan'] + str + colors['reset']
91
- return this},
92
- bw : function(str) {this.store += colors['bright_white'] + str + colors['reset']
93
- return this },
94
- //shorthand Background STANDARD
95
- K : function(str) {this.store += colors['bg_black']
96
- return this},
97
- R : function(str) {this.store += colors['bg_red']
98
- return this},
99
- G : function(str) {this.store += colors['bg_green']
100
- return this},
101
- Y : function(str) {this.store += colors['bg_yellow']
102
- return this},
103
- B : function(str) {this.store += colors['bg_blue']
104
- return this},
105
- M : function(str) {this.store += colors['bg_magenta']
106
- return this},
107
- C : function(str) {this.store += colors['bg_cyan']
108
- return this},
109
- W : function(str) {this.store += colors['bg_white']
110
- return this },
111
- //shorthand Background BRIGHT
112
- BB : function(str) {this.store += colors['bright_bg_black']
113
- return this},
114
- BR : function(str) {this.store += colors['bright_bg_red']
115
- return this},
116
- BG : function(str) {this.store += colors['bright_bg_green']
117
- return this},
118
- BY : function(str) {this.store += colors['bright_bg_yellow']
119
- return this},
120
- BB : function(str) {this.store += colors['bright_bg_blue']
121
- return this},
122
- BM : function(str) {this.store += colors['bright_bg_magenta']
123
- return this},
124
- BC : function(str) {this.store += colors['bright_bg_cyan']
125
- return this},
126
- BW : function(str) {this.store += colors['bright_bg_white']
127
- return this },
128
- //styles
129
- V : function() {this.store += colors['inverse']
130
- return this},
131
- _ : function() {this.store += colors['underline']
132
- return this},
133
- reset : function() {this.store += colors['reset']
134
- return this},
135
- I : function() {this.store += colors['intense']
136
- return this},
137
- blk : function() {this.store += colors['slow_blink']
138
- return this},
139
- rblk : function() {this.store += colors['rapid_blink']
140
- return this},
141
- end: function(){
142
- result = this.store
143
- //reset store
144
- this.store=''
145
- return result
146
- }
1
+ `use strict`
2
+
3
+ const colors = {
4
+ //style
5
+ "reset" : "\033[0m",
6
+ "intense" : "\033[1m",
7
+ "underline" : "\033[4m",
8
+ "inverse" : "\033[7m",
9
+ "slow_blink": "\033[5m",
10
+ "rapid_blink": "\033[6m",
11
+ // foreground colors STANDARD
12
+ "black" : "\033[30m",
13
+ "red" : "\033[31m",
14
+ "green" : "\033[32m",
15
+ "yellow" : "\033[33m",
16
+ "blue" : "\033[34m",
17
+ "magenta" : "\033[35m",
18
+ "cyan" : "\033[36m",
19
+ "white" : "\033[37m",
20
+ // foreground colors BRIGHT
21
+ "bright_black" : "\033[90m",
22
+ "bright_red" : "\033[91m",
23
+ "bright_green" : "\033[92m",
24
+ "bright_yellow" : "\033[93m",
25
+ "bright_blue" : "\033[94m",
26
+ "bright_magenta" : "\033[95m",
27
+ "bright_cyan" : "\033[96m",
28
+ "bright_white" : "\033[97m",
29
+ // background colors STANDARD
30
+ "bg_black" : "\033[40m",
31
+ "bg_red" : "\033[41m",
32
+ "bg_green" : "\033[42m",
33
+ "bg_yellow" : "\033[43m",
34
+ "bg_blue" : "\033[44m",
35
+ "bg_magenta" : "\033[45m",
36
+ "bg_cyan" : "\033[46m",
37
+ "bg_white" : "\033[47m",
38
+ // background colors BRIGHT
39
+ "bright_bg_black" : "\033[100m",
40
+ "bright_bg_red" : "\033[101m",
41
+ "bright_bg_green" : "\033[102m",
42
+ "bright_bg_yellow" : "\033[103m",
43
+ "bright_bg_blue" : "\033[104m",
44
+ "bright_bg_magenta" : "\033[105m",
45
+ "bright_bg_cyan" : "\033[106m",
46
+ "bright_bg_white" : "\033[107m"
47
+ }
48
+
49
+
50
+ module.exports = {
51
+ store: '',
52
+ black : function(str) {return colors['black'] + str + colors['reset']},
53
+ red : function(str) {return colors['red'] + str + colors['reset']},
54
+ green : function(str) {return colors['green'] + str + colors['reset']},
55
+ yellow : function(str) {return colors['yellow'] + str + colors['reset']},
56
+ blue : function(str) {return colors['blue'] + str + colors['reset']},
57
+ magenta : function(str) {return colors['magenta'] + str + colors['reset']},
58
+ cyan : function(str) {return colors['cyan'] + str + colors['reset']},
59
+ white : function(str) {return colors['white'] + str + colors['reset']},
60
+ //shorthand Foreground STANDARD
61
+ k : function(str) {this.store += colors['black'] + str + colors['reset']
62
+ return this},
63
+ r : function(str) {this.store += colors['red'] + str + colors['reset']
64
+ return this},
65
+ g : function(str) {this.store += colors['green'] + str + colors['reset']
66
+ return this},
67
+ y : function(str) {this.store += colors['yellow'] + str + colors['reset']
68
+ return this},
69
+ b : function(str) {this.store += colors['blue'] + str + colors['reset']
70
+ return this},
71
+ m : function(str) {this.store += colors['magenta'] + str + colors['reset']
72
+ return this},
73
+ c : function(str) {this.store += colors['cyan'] + str + colors['reset']
74
+ return this},
75
+ w : function(str) {this.store += colors['white'] + str + colors['reset']
76
+ return this },
77
+ //shorthand Foreground BRIGHT
78
+ bk : function(str) {this.store += colors['bright_black'] + str + colors['reset']
79
+ return this},
80
+ br : function(str) {this.store += colors['bright_red'] + str + colors['reset']
81
+ return this},
82
+ bg : function(str) {this.store += colors['bright_green'] + str + colors['reset']
83
+ return this},
84
+ by : function(str) {this.store += colors['bright_yellow'] + str + colors['reset']
85
+ return this},
86
+ bb : function(str) {this.store += colors['bright_blue'] + str + colors['reset']
87
+ return this},
88
+ bm : function(str) {this.store += colors['bright_magenta'] + str + colors['reset']
89
+ return this},
90
+ bc : function(str) {this.store += colors['bright_cyan'] + str + colors['reset']
91
+ return this},
92
+ bw : function(str) {this.store += colors['bright_white'] + str + colors['reset']
93
+ return this },
94
+ //shorthand Background STANDARD
95
+ K : function(str) {this.store += colors['bg_black']
96
+ return this},
97
+ R : function(str) {this.store += colors['bg_red']
98
+ return this},
99
+ G : function(str) {this.store += colors['bg_green']
100
+ return this},
101
+ Y : function(str) {this.store += colors['bg_yellow']
102
+ return this},
103
+ B : function(str) {this.store += colors['bg_blue']
104
+ return this},
105
+ M : function(str) {this.store += colors['bg_magenta']
106
+ return this},
107
+ C : function(str) {this.store += colors['bg_cyan']
108
+ return this},
109
+ W : function(str) {this.store += colors['bg_white']
110
+ return this },
111
+ //shorthand Background BRIGHT
112
+ BB : function(str) {this.store += colors['bright_bg_black']
113
+ return this},
114
+ BR : function(str) {this.store += colors['bright_bg_red']
115
+ return this},
116
+ BG : function(str) {this.store += colors['bright_bg_green']
117
+ return this},
118
+ BY : function(str) {this.store += colors['bright_bg_yellow']
119
+ return this},
120
+ BB : function(str) {this.store += colors['bright_bg_blue']
121
+ return this},
122
+ BM : function(str) {this.store += colors['bright_bg_magenta']
123
+ return this},
124
+ BC : function(str) {this.store += colors['bright_bg_cyan']
125
+ return this},
126
+ BW : function(str) {this.store += colors['bright_bg_white']
127
+ return this },
128
+ //styles
129
+ V : function() {this.store += colors['inverse']
130
+ return this},
131
+ _ : function() {this.store += colors['underline']
132
+ return this},
133
+ reset : function() {this.store += colors['reset']
134
+ return this},
135
+ I : function() {this.store += colors['intense']
136
+ return this},
137
+ blk : function() {this.store += colors['slow_blink']
138
+ return this},
139
+ rblk : function() {this.store += colors['rapid_blink']
140
+ return this},
141
+ end: function(){
142
+ result = this.store
143
+ //reset store
144
+ this.store=''
145
+ return result
146
+ }
147
147
  }
package/package.json CHANGED
@@ -1,17 +1,22 @@
1
1
  {
2
2
  "name": "8colors",
3
- "version": "1.0.0",
4
- "description": "ANSI Colors for the terminal console",
3
+ "version": "1.0.2",
4
+ "description": "chainable ansi 8 terminal colors",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1"
8
8
  },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/jmdisuanco/8colors.git"
12
+ },
9
13
  "keywords": [
10
- "ansi",
11
- "colors",
12
- "eight",
13
14
  "8colors",
15
+ "terminal",
14
16
  "console",
17
+ "chainable",
18
+ "ansi",
19
+ "colors",
15
20
  "log",
16
21
  "cli",
17
22
  "color",
@@ -19,5 +24,14 @@
19
24
  "console.log"
20
25
  ],
21
26
  "author": "John Martin R. Disuanco",
22
- "license": "MIT"
23
- }
27
+ "license": "MIT",
28
+ "bugs": {
29
+ "url": "https://github.com/jmdisuanco/8colors/issues"
30
+ },
31
+ "homepage": "https://github.com/jmdisuanco/8colors#readme",
32
+ "files": [
33
+ "index.js",
34
+ "index.d.ts"
35
+ ],
36
+ "types": "index.d.ts"
37
+ }
package/.npmignore DELETED
@@ -1,59 +0,0 @@
1
- # Logs
2
- logs
3
- *.log
4
- npm-debug.log*
5
- yarn-debug.log*
6
- yarn-error.log*
7
-
8
- # Runtime data
9
- pids
10
- *.pid
11
- *.seed
12
- *.pid.lock
13
-
14
- # Directory for instrumented libs generated by jscoverage/JSCover
15
- lib-cov
16
-
17
- # Coverage directory used by tools like istanbul
18
- coverage
19
-
20
- # nyc test coverage
21
- .nyc_output
22
-
23
- # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
24
- .grunt
25
-
26
- # Bower dependency directory (https://bower.io/)
27
- bower_components
28
-
29
- # node-waf configuration
30
- .lock-wscript
31
-
32
- # Compiled binary addons (http://nodejs.org/api/addons.html)
33
- build/Release
34
-
35
- # Dependency directories
36
- node_modules/
37
- jspm_packages/
38
-
39
- # Typescript v1 declaration files
40
- typings/
41
-
42
- # Optional npm cache directory
43
- .npm
44
-
45
- # Optional eslint cache
46
- .eslintcache
47
-
48
- # Optional REPL history
49
- .node_repl_history
50
-
51
- # Output of 'npm pack'
52
- *.tgz
53
-
54
- # Yarn Integrity file
55
- .yarn-integrity
56
-
57
- # dotenv environment variables file
58
- .env
59
-
package/example.js DELETED
@@ -1,17 +0,0 @@
1
- const c = require('./index')
2
-
3
- var title ='WARNING'
4
-
5
- //straight up
6
- console.log(c.green('color me green'))
7
-
8
- console.log(c.red(title))
9
-
10
- //chaining
11
- console.log (c.b('color me blue').m(' and I am Magenta').bm(' I am bright Magenta').end())
12
-
13
- //background color
14
- console.log(c.R().w(title).end())
15
-
16
- console.log(c.R().w(title).by(' You are using and awesome library!').end())
17
-