1 | {"version":3,"file":"color.js","sourceRoot":"","sources":["../../../src/lib/utils/color.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wDAA0C;AAC1C,6BAAkC;AAIlC,SAAS,YAAY;IACnB,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;QAC1C,uDAAuD;QACvD,sCAAsC;QACtC,uCAAuC;QACvC,+CAA+C;QAC/C,gGAAgG;QAChG,6GAA6G;QAC7G,QAAQ,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC;YAChC,KAAK,EAAE,CAAC;YACR,KAAK,MAAM,CAAC;YACZ,KAAK,GAAG,CAAC;YACT,KAAK,GAAG,CAAC;YACT,KAAK,GAAG;gBACN,OAAO,IAAI,CAAC;YACd;gBACE,OAAO,KAAK,CAAC;QACjB,CAAC;IACH,CAAC;IAED,IAAI,OAAO,CAAC,MAAM,YAAY,iBAAW,EAAE,CAAC;QAC1C,OAAO,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC;IAC5C,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAGD,6FAA6F;AAC7F,mGAAmG;AACnG,MAAM,MAAM,GAAI,UAAwD,CAAC,MAAM,EAAE,CAAC;AAGzE,wBAAM;AAFf,MAAM,CAAC,OAAO,GAAG,YAAY,EAAE,CAAC","sourcesContent":["import * as ansiColors from 'ansi-colors';\nimport { WriteStream } from 'tty';\n\ntype AnsiColors = typeof ansiColors;\n\nfunction supportColor(): boolean {\n if (process.env.FORCE_COLOR !== undefined) {\n // 2 colors: FORCE_COLOR = 0 (Disables colors), depth 1\n // 16 colors: FORCE_COLOR = 1, depth 4\n // 256 colors: FORCE_COLOR = 2, depth 8\n // 16,777,216 colors: FORCE_COLOR = 3, depth 16\n // See: https://nodejs.org/dist/latest-v12.x/docs/api/tty.html#tty_writestream_getcolordepth_env\n // and https://github.com/nodejs/node/blob/b9f36062d7b5c5039498e98d2f2c180dca2a7065/lib/internal/tty.js#L106;\n switch (process.env.FORCE_COLOR) {\n case '':\n case 'true':\n case '1':\n case '2':\n case '3':\n return true;\n default:\n return false;\n }\n }\n\n if (process.stdout instanceof WriteStream) {\n return process.stdout.getColorDepth() > 1;\n }\n\n return false;\n}\n\n\n// Create a separate instance to prevent unintended global changes to the color configuration\n// Create function is not defined in the typings. See: https://github.com/doowb/ansi-colors/pull/44\nconst colors = (ansiColors as AnsiColors & { create: () => AnsiColors }).create();\ncolors.enabled = supportColor();\n\nexport { colors };\n"]} |