diff options
author | Marvin Hagemeister <marvin@deno.com> | 2024-07-19 12:39:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-19 12:39:05 +0200 |
commit | ee2e6933403811d398540e0e8275b2d216546dd8 (patch) | |
tree | 4ed2944dfbc516ea127c4bee50cc771ac12f902d /runtime/worker_bootstrap.rs | |
parent | 76b8ecbb6d8c07d29c34fb0b301cc3bf3351e3aa (diff) |
fix(node): support `tty.hasColors()` and `tty.getColorDepth()` (#24619)
This PR adds support for
[`tty.WriteStream.prototype.hasColors()`](https://nodejs.org/api/tty.html#writestreamhascolorscount-env)
and
[`tty.WriteStream.prototype.getColorDepth()`](https://nodejs.org/api/tty.html#writestreamgetcolordepthenv).
I couldn't find any usage on GitHub which passes parameters to it.
Therefore I've skipped adding support for the `env` parameter to keep
our snapshot size small.
Based on https://github.com/denoland/deno_terminal/pull/3
Fixes https://github.com/denoland/deno/issues/24616
Diffstat (limited to 'runtime/worker_bootstrap.rs')
-rw-r--r-- | runtime/worker_bootstrap.rs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/runtime/worker_bootstrap.rs b/runtime/worker_bootstrap.rs index 0838da2d1..b13c3c428 100644 --- a/runtime/worker_bootstrap.rs +++ b/runtime/worker_bootstrap.rs @@ -77,6 +77,7 @@ pub struct BootstrapOptions { pub no_color: bool, pub is_stdout_tty: bool, pub is_stderr_tty: bool, + pub color_level: deno_terminal::colors::ColorLevel, // --unstable flag, deprecated pub unstable: bool, // --unstable-* flags @@ -111,6 +112,7 @@ impl Default for BootstrapOptions { no_color: !colors::use_color(), is_stdout_tty: deno_terminal::is_stdout_tty(), is_stderr_tty: deno_terminal::is_stderr_tty(), + color_level: colors::get_color_level(), enable_op_summary_metrics: Default::default(), enable_testing_features: Default::default(), log_level: Default::default(), |