@travetto/terminal 3.3.0 → 3.3.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/terminal",
3
- "version": "3.3.0",
3
+ "version": "3.3.1",
4
4
  "description": "General terminal support",
5
5
  "keywords": [
6
6
  "terminal",
@@ -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
  })();