@travetto/terminal 3.3.0 → 3.4.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +1 -1
- package/src/color-output.ts +2 -1
- package/src/terminal.ts +1 -0
package/README.md
CHANGED
|
@@ -63,7 +63,7 @@ This module follows the pattern [Node](https://nodejs.org) follows with respect
|
|
|
63
63
|
|
|
64
64
|
**Terminal: Node help on colors**
|
|
65
65
|
```bash
|
|
66
|
-
$
|
|
66
|
+
$ node -h | grep -i color
|
|
67
67
|
|
|
68
68
|
FORCE_COLOR when set to 'true', 1, 2, 3, or an
|
|
69
69
|
empty string causes NO_COLOR and
|
package/package.json
CHANGED
package/src/color-output.ts
CHANGED
|
@@ -41,10 +41,11 @@ export class ColorOutputUtil {
|
|
|
41
41
|
* Read foreground/background color if env var is set
|
|
42
42
|
*/
|
|
43
43
|
static async readBackgroundScheme(
|
|
44
|
+
stream: tty.WriteStream,
|
|
44
45
|
query: () => Promise<RGB | undefined> | RGB | undefined,
|
|
45
46
|
env: string | undefined = process.env.COLORFGBG
|
|
46
47
|
): Promise<TermColorScheme | undefined> {
|
|
47
|
-
let color = await query();
|
|
48
|
+
let color = stream.isTTY ? await query() : undefined;
|
|
48
49
|
if (!color && env) {
|
|
49
50
|
const [, bg] = env.split(';');
|
|
50
51
|
color = ColorDefineUtil.rgbFromAnsi256(+bg);
|
package/src/terminal.ts
CHANGED
|
@@ -91,6 +91,7 @@ export class Terminal implements TermState {
|
|
|
91
91
|
this.#init = (async (): Promise<void> => {
|
|
92
92
|
this.#colorLevel ??= await ColorOutputUtil.readTermColorLevel(this.#output);
|
|
93
93
|
this.#backgroundScheme ??= await ColorOutputUtil.readBackgroundScheme(
|
|
94
|
+
this.#output,
|
|
94
95
|
() => this.interactive ? this.#query.backgroundColor() : undefined
|
|
95
96
|
);
|
|
96
97
|
})();
|