mirror of
https://github.com/flynx/colors.js.git
synced 2025-10-28 18:40:09 +00:00
[docs] New examples in example.js
This commit is contained in:
parent
600c9718e4
commit
2f03cd933b
10
example.js
10
example.js
@ -20,6 +20,7 @@ console.log(colors.stripColors(test));
|
||||
console.log(colors.grey("a") + colors.black(" b"));
|
||||
|
||||
colors.addSequencer("america", function(letter, i, exploded) {
|
||||
if(letter === " ") return letter;
|
||||
switch(i%3) {
|
||||
case 0: return letter.red;
|
||||
case 1: return letter.white;
|
||||
@ -27,4 +28,13 @@ colors.addSequencer("america", function(letter, i, exploded) {
|
||||
}
|
||||
});
|
||||
|
||||
colors.addSequencer("random", (function() {
|
||||
var available = ['bold', 'underline', 'italic', 'inverse', 'grey', 'yellow', 'red', 'green', 'blue', 'white', 'cyan', 'magenta'];
|
||||
|
||||
return function(letter, i, exploded) {
|
||||
return letter === " " ? letter : letter[available[Math.round(Math.random() * (available.length - 1))]];
|
||||
};
|
||||
})());
|
||||
|
||||
console.log("AMERICA! F--K YEAH!".america);
|
||||
console.log("So apparently I've been to Mars, with all the little green men. But you know, I don't recall.".random);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user