Skip to content

Commit

Permalink
Merge pull request #102 from ericcornelissen/85-no-color
Browse files Browse the repository at this point in the history
Respect the `NO_COLOR` environment variable
  • Loading branch information
jeemok committed Sep 9, 2024
2 parents b2f400f + 4a4fe64 commit 5e64f4a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/utils/color.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ const COLORS = <const>{
* @return {String} Message
*/
export function color(message: string, fgColor?: Color, bgColor?: Color): string {
if ('NO_COLOR' in process.env) {
return message;
}

return [
<ColorCode>get(COLORS, `${fgColor}.fg`, ''),
<ColorCode>get(COLORS, `${bgColor}.bg`, ''),
Expand Down

0 comments on commit 5e64f4a

Please sign in to comment.