icoa-cli 2.19.23 → 2.19.24
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/dist/lib/theme.js +13 -0
- package/package.json +1 -1
package/dist/lib/theme.js
CHANGED
|
@@ -34,10 +34,21 @@ function supportsAnsi() {
|
|
|
34
34
|
return depth >= 8;
|
|
35
35
|
return true;
|
|
36
36
|
}
|
|
37
|
+
// When icoa-cli runs inside the ICOA Terminal (Tauri + xterm.js), the host is
|
|
38
|
+
// already pre-themed to the exact Darcula palette we'd be setting. Every OSC
|
|
39
|
+
// and SGR we'd emit is a no-op in terms of color, but the \x1b[2J inside our
|
|
40
|
+
// init/reset sequences would clear the grid visibly. Skip the paint entirely
|
|
41
|
+
// in that environment so the banner simply appears in the shell cursor
|
|
42
|
+
// position and scrollback is preserved on exit.
|
|
43
|
+
function isIcoaTerminal() {
|
|
44
|
+
return process.env.ICOA_TERMINAL === '1';
|
|
45
|
+
}
|
|
37
46
|
let armed = false;
|
|
38
47
|
export function setTerminalTheme() {
|
|
39
48
|
if (!supportsAnsi())
|
|
40
49
|
return;
|
|
50
|
+
if (isIcoaTerminal())
|
|
51
|
+
return; // host is already Darcula; nothing to do
|
|
41
52
|
process.stdout.write(OSC_INIT + SGR_INIT);
|
|
42
53
|
if (!armed) {
|
|
43
54
|
armed = true;
|
|
@@ -58,5 +69,7 @@ export function setTerminalTheme() {
|
|
|
58
69
|
export function resetTerminalTheme() {
|
|
59
70
|
if (!supportsAnsi())
|
|
60
71
|
return;
|
|
72
|
+
if (isIcoaTerminal())
|
|
73
|
+
return; // nothing to undo
|
|
61
74
|
process.stdout.write(OSC_RESET + SGR_RESET);
|
|
62
75
|
}
|