mirror of
https://github.com/flynx/colors.js.git
synced 2025-11-01 04:20:12 +00:00
[minor] Add none mode, which doesn't change string
See nodejitsu/jitsu#101 - we need an easy way to strip all colors from output.
This commit is contained in:
parent
4a63717497
commit
50264b9238
@ -107,8 +107,10 @@ function stylize(str, style) {
|
|||||||
'red' : ['<span style="color:red;">', '</span>'],
|
'red' : ['<span style="color:red;">', '</span>'],
|
||||||
'yellow' : ['<span style="color:yellow;">', '</span>']
|
'yellow' : ['<span style="color:yellow;">', '</span>']
|
||||||
};
|
};
|
||||||
|
} else if (exports.mode == 'none') {
|
||||||
|
return str;
|
||||||
} else {
|
} else {
|
||||||
console.log('unsupported mode, try "browser" or "console"');
|
console.log('unsupported mode, try "browser", "console" or "none"');
|
||||||
}
|
}
|
||||||
|
|
||||||
return styles[style][0] + str + styles[style][1];
|
return styles[style][0] + str + styles[style][1];
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user