mirror of
https://github.com/flynx/colors.js.git
synced 2025-10-29 11:00:11 +00:00
Merge pull request #236 from Marak/solve-circular-refs
Solve circular refs
This commit is contained in:
commit
21abbcbae5
@ -37,7 +37,7 @@ console.log('Setting themes is useful');
|
|||||||
// Load theme with JSON literal
|
// Load theme with JSON literal
|
||||||
colors.setTheme({
|
colors.setTheme({
|
||||||
silly: 'rainbow',
|
silly: 'rainbow',
|
||||||
input: 'grey',
|
input: 'blue',
|
||||||
verbose: 'cyan',
|
verbose: 'cyan',
|
||||||
prompt: 'grey',
|
prompt: 'grey',
|
||||||
info: 'green',
|
info: 'green',
|
||||||
@ -54,14 +54,14 @@ console.log(colors.error('this is an error'));
|
|||||||
// outputs yellow text
|
// outputs yellow text
|
||||||
console.log(colors.warn('this is a warning'));
|
console.log(colors.warn('this is a warning'));
|
||||||
|
|
||||||
// outputs grey text
|
// outputs blue text
|
||||||
console.log(colors.input('this is an input'));
|
console.log(colors.input('this is an input'));
|
||||||
|
|
||||||
|
|
||||||
// console.log('Generic logging theme as file'.green.bold.underline);
|
// console.log('Generic logging theme as file'.green.bold.underline);
|
||||||
|
|
||||||
// Load a theme from file
|
// Load a theme from file
|
||||||
colors.setTheme(__dirname + '/../themes/generic-logging.js');
|
colors.setTheme(require(__dirname + '/../themes/generic-logging.js'));
|
||||||
|
|
||||||
// outputs red text
|
// outputs red text
|
||||||
console.log(colors.error('this is an error'));
|
console.log(colors.error('this is an error'));
|
||||||
|
|||||||
4
index.d.ts
vendored
4
index.d.ts
vendored
@ -116,8 +116,8 @@ declare global {
|
|||||||
bgCyan: string;
|
bgCyan: string;
|
||||||
bgWhite: string;
|
bgWhite: string;
|
||||||
|
|
||||||
reset: string;
|
reset: string;
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
bold: string;
|
bold: string;
|
||||||
dim: string;
|
dim: string;
|
||||||
italic: string;
|
italic: string;
|
||||||
|
|||||||
@ -185,10 +185,10 @@ colors.zalgo = require('./custom/zalgo');
|
|||||||
|
|
||||||
// maps
|
// maps
|
||||||
colors.maps = {};
|
colors.maps = {};
|
||||||
colors.maps.america = require('./maps/america');
|
colors.maps.america = require('./maps/america')(colors);
|
||||||
colors.maps.zebra = require('./maps/zebra');
|
colors.maps.zebra = require('./maps/zebra')(colors);
|
||||||
colors.maps.rainbow = require('./maps/rainbow');
|
colors.maps.rainbow = require('./maps/rainbow')(colors);
|
||||||
colors.maps.random = require('./maps/random');
|
colors.maps.random = require('./maps/random')(colors);
|
||||||
|
|
||||||
for (var map in colors.maps) {
|
for (var map in colors.maps) {
|
||||||
(function(map) {
|
(function(map) {
|
||||||
|
|||||||
@ -1,6 +1,4 @@
|
|||||||
var colors = require('../colors');
|
module['exports'] = function(colors) {
|
||||||
|
|
||||||
module['exports'] = (function() {
|
|
||||||
return function(letter, i, exploded) {
|
return function(letter, i, exploded) {
|
||||||
if (letter === ' ') return letter;
|
if (letter === ' ') return letter;
|
||||||
switch (i%3) {
|
switch (i%3) {
|
||||||
@ -9,4 +7,4 @@ module['exports'] = (function() {
|
|||||||
case 2: return colors.blue(letter);
|
case 2: return colors.blue(letter);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
})();
|
};
|
||||||
|
|||||||
@ -1,6 +1,4 @@
|
|||||||
var colors = require('../colors');
|
module['exports'] = function(colors) {
|
||||||
|
|
||||||
module['exports'] = (function() {
|
|
||||||
// RoY G BiV
|
// RoY G BiV
|
||||||
var rainbowColors = ['red', 'yellow', 'green', 'blue', 'magenta'];
|
var rainbowColors = ['red', 'yellow', 'green', 'blue', 'magenta'];
|
||||||
return function(letter, i, exploded) {
|
return function(letter, i, exploded) {
|
||||||
@ -10,5 +8,5 @@ module['exports'] = (function() {
|
|||||||
return colors[rainbowColors[i++ % rainbowColors.length]](letter);
|
return colors[rainbowColors[i++ % rainbowColors.length]](letter);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
})();
|
};
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,4 @@
|
|||||||
var colors = require('../colors');
|
module['exports'] = function(colors) {
|
||||||
|
|
||||||
module['exports'] = (function() {
|
|
||||||
var available = ['underline', 'inverse', 'grey', 'yellow', 'red', 'green',
|
var available = ['underline', 'inverse', 'grey', 'yellow', 'red', 'green',
|
||||||
'blue', 'white', 'cyan', 'magenta'];
|
'blue', 'white', 'cyan', 'magenta'];
|
||||||
return function(letter, i, exploded) {
|
return function(letter, i, exploded) {
|
||||||
@ -9,4 +7,4 @@ module['exports'] = (function() {
|
|||||||
available[Math.round(Math.random() * (available.length - 2))]
|
available[Math.round(Math.random() * (available.length - 2))]
|
||||||
](letter);
|
](letter);
|
||||||
};
|
};
|
||||||
})();
|
};
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
var colors = require('../colors');
|
module['exports'] = function(colors) {
|
||||||
|
return function(letter, i, exploded) {
|
||||||
module['exports'] = function(letter, i, exploded) {
|
return i % 2 === 0 ? letter : colors.inverse(letter);
|
||||||
return i % 2 === 0 ? letter : colors.inverse(letter);
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user