@wrongstack/tui 0.276.2 → 0.276.4
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/index.js +18 -3
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -45,6 +45,17 @@ function softColor(color) {
|
|
|
45
45
|
if (!color) return color;
|
|
46
46
|
return pastel[color] ?? color;
|
|
47
47
|
}
|
|
48
|
+
function detectSupportsBackground(env = process.env, isTTY = process.stdout.isTTY ?? false) {
|
|
49
|
+
if (!isTTY) return false;
|
|
50
|
+
if (typeof env.NO_COLOR === "string" && env.NO_COLOR !== "") return false;
|
|
51
|
+
const colorterm = env.COLORTERM ?? "";
|
|
52
|
+
if (/^(truecolor|24bit)$/i.test(colorterm)) return true;
|
|
53
|
+
const term = env.TERM ?? "";
|
|
54
|
+
if (/truecolor|24bit/i.test(term)) return true;
|
|
55
|
+
if (/256(color)?/i.test(term)) return true;
|
|
56
|
+
if (colorterm !== "" && colorterm !== "false") return true;
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
48
59
|
var theme = Object.freeze({
|
|
49
60
|
accent: pastel.cyan,
|
|
50
61
|
user: pastel.yellow,
|
|
@@ -66,7 +77,11 @@ var theme = Object.freeze({
|
|
|
66
77
|
},
|
|
67
78
|
// Diff blocks render dark text on a pastel wash (see DiffBlock).
|
|
68
79
|
diffAddBg: pastel.green,
|
|
69
|
-
diffDelBg: pastel.red
|
|
80
|
+
diffDelBg: pastel.red,
|
|
81
|
+
// Whether the host terminal can render truecolor backgrounds. Diff blocks
|
|
82
|
+
// downgrade to marker-only rendering when this is false (e.g. `TERM=xterm`,
|
|
83
|
+
// `NO_COLOR=1`, captured/piped output).
|
|
84
|
+
supportsBackground: detectSupportsBackground()
|
|
70
85
|
});
|
|
71
86
|
var colorProps = (color, backgroundColor) => {
|
|
72
87
|
const c = softColor(color);
|
|
@@ -6206,7 +6221,7 @@ var Entry = React5.memo(function Entry2({
|
|
|
6206
6221
|
);
|
|
6207
6222
|
return summaryLine ? /* @__PURE__ */ jsx(Text, { dimColor: true, italic: true, children: summaryLine }) : null;
|
|
6208
6223
|
})(),
|
|
6209
|
-
multiDiffs.map((item) => /* @__PURE__ */ jsx(DiffFileBlock, { path: item.path, preview: item.preview, useColor:
|
|
6224
|
+
multiDiffs.map((item) => /* @__PURE__ */ jsx(DiffFileBlock, { path: item.path, preview: item.preview, useColor: theme.supportsBackground }, item.path))
|
|
6210
6225
|
] }) : entry.resultRenderMode !== "simple" && diff ? /* @__PURE__ */ jsx(
|
|
6211
6226
|
DiffBlock,
|
|
6212
6227
|
{
|
|
@@ -6216,7 +6231,7 @@ var Entry = React5.memo(function Entry2({
|
|
|
6216
6231
|
removed: diff.removed,
|
|
6217
6232
|
hiddenAdded: diff.hiddenAdded,
|
|
6218
6233
|
hiddenRemoved: diff.hiddenRemoved,
|
|
6219
|
-
useColor:
|
|
6234
|
+
useColor: theme.supportsBackground
|
|
6220
6235
|
}
|
|
6221
6236
|
) : null
|
|
6222
6237
|
] });
|