-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
33b0332
commit ef458f7
Showing
68 changed files
with
2,947 additions
and
1,747 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
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 was deleted.
Oops, something went wrong.
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,29 @@ | ||
import * as tty from 'tty' | ||
|
||
export const is_color_support = | ||
!('NO_COLOR' in process.env || process.argv.includes('--no-color')) && | ||
('FORCE_COLOR' in process.env || | ||
process.argv.includes('--color') || | ||
process.platform === 'win32' || | ||
(tty.isatty(1) && process.env.TERM !== 'dumb') || | ||
'CI' in process.env) | ||
|
||
const format = (start, end) => (input) => { | ||
const open = `\x1b[${start}m` | ||
const close = `\x1b[${end}m` | ||
const string = '' + input | ||
const regex = new RegExp(`\\x1b\\[${end}m`, 'g') | ||
|
||
return is_color_support ? open + string.replace(regex, open) + close : String(string) | ||
} | ||
|
||
export default { | ||
inverse: format(7, 27), | ||
yellow: format(93, 39), | ||
green: format(92, 39), | ||
cyan: format(96, 39), | ||
gray: format(90, 39), | ||
bold: format(1, 22), | ||
red: format(91, 39), | ||
dim: format(2, 22), | ||
} |
Oops, something went wrong.