-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve the output format to make it more readable
- Loading branch information
1 parent
7cbbb8b
commit ad3232a
Showing
6 changed files
with
101 additions
and
63 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 |
---|---|---|
@@ -1,16 +1,19 @@ | ||
const green = "\x1b[32m"; | ||
const yellow = "\x1b[33m"; | ||
const red = "\x1b[31m"; | ||
const greenFg = "\x1b[32m"; | ||
const yellowFg = "\x1b[33m"; | ||
const redFg = "\x1b[31m"; | ||
const blackBg = "\x1b[40m"; | ||
const bold = "\x1b[1m"; | ||
const end = "\x1b[0m"; | ||
|
||
module.exports.b = (text, time) => { | ||
module.exports.fg = (text, time) => { | ||
let colour; | ||
if (time >= 0) colour = green; | ||
if (time > 2000) colour = yellow; | ||
if (time > 10000) colour = red; | ||
if (time >= 0) colour = greenFg; | ||
if (time > 2000) colour = yellowFg; | ||
if (time > 10000) colour = redFg; | ||
|
||
return (colour || "") + bold + text + end; | ||
}; | ||
|
||
module.exports.bg = text => blackBg + greenFg + bold + text + end; | ||
|
||
module.exports.stripColours = text => text.replace(/\x1b\[[0-9]+m/g, ""); |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.