1 | "use strict";
|
2 |
|
3 | var clc = require("./");
|
4 |
|
5 | var colors = ["black", "red", "green", "yellow", "blue", "magenta", "cyan", "white"];
|
6 |
|
7 |
|
8 | var w = function (message) { process.stdout.write(message); };
|
9 |
|
10 |
|
11 | var printColors = function (title, style) {
|
12 | var j = colors.length, color, colorText, tint, i;
|
13 |
|
14 | w(" > " + clc.whiteBright(title) + " ");
|
15 | for (i = 0; i < j; i++) {
|
16 | tint = clc;
|
17 | color = colors[i];
|
18 | colorText = color.toUpperCase();
|
19 |
|
20 | if (style === "foreground") {
|
21 | tint = tint[color];
|
22 |
|
23 | if (color === "black") {
|
24 | tint = tint.bgBlackBright;
|
25 | }
|
26 | }
|
27 |
|
28 | if (style === "foregroundBright") {
|
29 | tint = tint[color + "Bright"];
|
30 | }
|
31 |
|
32 | if (style === "background") {
|
33 | tint = tint["bg" + color.slice(0, 1).toUpperCase() + color.slice(1)];
|
34 |
|
35 | if (color === "white") {
|
36 | tint = tint.whiteBright;
|
37 | }
|
38 | }
|
39 |
|
40 | if (style === "backgroundBright") {
|
41 | tint = tint["bg" + color.slice(0, 1).toUpperCase() + color.slice(1) + "Bright"];
|
42 | }
|
43 |
|
44 | w(tint(colorText) + " ");
|
45 | }
|
46 | w("\n");
|
47 | };
|
48 |
|
49 |
|
50 | w(clc.reset);
|
51 |
|
52 | w("\n SMILE TEST\n\n");
|
53 |
|
54 |
|
55 | w(clc(" "));
|
56 | w(clc.bgYellowBright(" "));
|
57 | w(clc("\n"));
|
58 | w(clc(" "));
|
59 | w(clc.bgYellowBright(" "));
|
60 | w(clc("\n"));
|
61 | w(clc(" "));
|
62 | w(clc.bgYellowBright(" "));
|
63 | w(clc("\n"));
|
64 | w(clc(" "));
|
65 | w(clc.bgYellowBright(" "));
|
66 | w(clc("\n"));
|
67 | w(clc(" "));
|
68 | w(clc.bgYellowBright(" "));
|
69 | w(clc("\n"));
|
70 | w(clc(" "));
|
71 | w(clc.bgYellowBright(" "));
|
72 | w(clc("\n"));
|
73 |
|
74 |
|
75 | w(clc.move(7, -5));
|
76 | w(clc.blueBright.bgYellowBright("O"));
|
77 | w(clc.move(1, 0));
|
78 | w(clc.blueBright.bgYellowBright("O"));
|
79 |
|
80 |
|
81 | w(clc.move.to(8, 5));
|
82 | w(clc.redBright.bgYellowBright("\u25A0"));
|
83 |
|
84 |
|
85 | w(clc.move.down(2));
|
86 | w(clc.move.left(2));
|
87 | w(clc.red.bgYellowBright("\u2588\u2584\u2588"));
|
88 |
|
89 |
|
90 | w(clc.move.to(0, 9));
|
91 |
|
92 |
|
93 | w("\n COLORS TESTS\n");
|
94 | printColors("FOREGROUNDS (DEFAULT)", "foreground");
|
95 | printColors("FOREGROUNDS (BRIGHT) ", "foregroundBright");
|
96 | printColors("BACKGROUNDS (DEFAULT)", "background");
|
97 | printColors("BACKGROUNDS (BRIGHT) ", "backgroundBright");
|
98 |
|
99 |
|
100 | w("\n ART TESTS\n\n");
|
101 | w(
|
102 | clc.art("\t.01111111112.\n\t.3.........3.\n\t.3.........3.\n\t.41111111115.\n", {
|
103 | "0": clc.bgBlue.yellowBright("\u2554"),
|
104 | "1": clc.bgBlue.yellowBright("\u2550"),
|
105 | "2": clc.bgBlue.yellowBright("\u2557"),
|
106 | "3": clc.bgBlue.yellowBright("\u2551"),
|
107 | "4": clc.bgBlue.yellowBright("\u255A"),
|
108 | "5": clc.bgBlue.yellowBright("\u255D"),
|
109 | ".": clc.bgBlue(" ")
|
110 | })
|
111 | );
|
112 | w(clc.move(11, -3));
|
113 | w(clc.bgBlue.whiteBright("Hello"));
|
114 | w(clc.move(-3, 1));
|
115 | w(clc.bgBlue.whiteBright("World"));
|
116 | w(clc.move(0, 2));
|
117 | w("\n");
|