summaryrefslogtreecommitdiff
path: root/runtime/ops/bootstrap.rs
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/ops/bootstrap.rs')
-rw-r--r--runtime/ops/bootstrap.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/runtime/ops/bootstrap.rs b/runtime/ops/bootstrap.rs
index c5c193ef3..997bebd76 100644
--- a/runtime/ops/bootstrap.rs
+++ b/runtime/ops/bootstrap.rs
@@ -2,6 +2,7 @@
use deno_core::op2;
use deno_core::OpState;
+use deno_terminal::colors::ColorLevel;
use serde::Serialize;
use crate::BootstrapOptions;
@@ -16,6 +17,7 @@ deno_core::extension!(
op_bootstrap_language,
op_bootstrap_log_level,
op_bootstrap_no_color,
+ op_bootstrap_color_depth,
op_bootstrap_is_stdout_tty,
op_bootstrap_is_stderr_tty,
op_bootstrap_unstable_args,
@@ -127,6 +129,17 @@ pub fn op_bootstrap_no_color(state: &mut OpState) -> bool {
}
#[op2(fast)]
+pub fn op_bootstrap_color_depth(state: &mut OpState) -> i32 {
+ let options = state.borrow::<BootstrapOptions>();
+ match options.color_level {
+ ColorLevel::None => 1,
+ ColorLevel::Ansi => 4,
+ ColorLevel::Ansi256 => 8,
+ ColorLevel::TrueColor => 24,
+ }
+}
+
+#[op2(fast)]
pub fn op_bootstrap_is_stdout_tty(state: &mut OpState) -> bool {
let options = state.borrow::<BootstrapOptions>();
options.is_stdout_tty