diff --git a/Nasal/debug.nas b/Nasal/debug.nas
index 3a70c4867..51320253c 100644
--- a/Nasal/debug.nas
+++ b/Nasal/debug.nas
@@ -49,7 +49,7 @@
 var _c = func nil;
 
 var color = func(enabled) {
-	if (enabled)
+	if (enabled and getprop("/sim/startup/stderr-to-terminal"))
 		_c = func(color, s) { "\x1b[" ~ color ~ "m" ~ s ~ "\x1b[m" }
 	else
 		_c = func(dummy, s) { s }