-
-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Breaking: Replace chalk with ansi-colors (closes #125)
- Loading branch information
1 parent
94f3041
commit 9df91cc
Showing
14 changed files
with
118 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
'use strict'; | ||
|
||
var colors = require('ansi-colors'); | ||
var supportsColor = require('color-support'); | ||
|
||
var hasColors = colorize(); | ||
|
||
module.exports = { | ||
red: hasColors ? colors.red : noColor, | ||
green: hasColors ? colors.green : noColor, | ||
blue: hasColors ? colors.blue : noColor, | ||
magenta: hasColors ? colors.magenta : noColor, | ||
cyan: hasColors ? colors.cyan : noColor, | ||
white: hasColors ? colors.white : noColor, | ||
gray: hasColors ? colors.gray : noColor, | ||
bgred: hasColors ? colors.bgred : noColor, | ||
bold: hasColors ? colors.bold : noColor, | ||
}; | ||
|
||
function noColor(message) { | ||
return message; | ||
} | ||
|
||
function hasFlag(flag) { | ||
return (process.argv.indexOf('--' + flag) !== -1); | ||
} | ||
|
||
function colorize() { | ||
if (hasFlag('no-color')) { | ||
return false; | ||
} | ||
|
||
if (hasFlag('color')) { | ||
return true; | ||
} | ||
|
||
return supportsColor(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.