Debian Codegraph @

cli-color/examples/basic.js

raw
1 "use strict";
2
3 var clc = require("../");
4
5 console.log("Output colored text:");
6 console.log(clc.red("Text in red"));
7
8 console.log("Styles can be mixed:");
9 console.log(clc.red.bgWhite.underline("Underlined red text on white background."));
10
11 console.log("Styled text can be mixed with unstyled:");
12 console.log(clc.red("red") + " plain " + clc.blue("blue"));
13
14 console.log("Styled text can be nested:");
15 console.log(clc.red("red " + clc.blue("blue") + " red"));
16
17 console.log("Best way is to predefine needed stylings and then use it:");
18
19 var error = clc.red.bold;
20 var warn = clc.yellow;
21 var notice = clc.blue;
22
23 console.log(error("Error!"));
24 console.log(warn("Warning"));
25 console.log(notice("Notice"));