@basiclines/rampa 1.1.1 → 1.1.3
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 +19 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9898,8 +9898,19 @@ function formatCss2(ramps) {
|
|
|
9898
9898
|
}
|
|
9899
9899
|
|
|
9900
9900
|
// src/utils/terminal-colors.ts
|
|
9901
|
+
function supportsTruecolor() {
|
|
9902
|
+
const colorterm = process.env.COLORTERM?.toLowerCase() || "";
|
|
9903
|
+
if (colorterm === "truecolor" || colorterm === "24bit") {
|
|
9904
|
+
return true;
|
|
9905
|
+
}
|
|
9906
|
+
const term = process.env.TERM?.toLowerCase() || "";
|
|
9907
|
+
if (term.includes("truecolor") || term.includes("24bit") || term.includes("direct")) {
|
|
9908
|
+
return true;
|
|
9909
|
+
}
|
|
9910
|
+
return false;
|
|
9911
|
+
}
|
|
9901
9912
|
function hasLimitedColorSupport() {
|
|
9902
|
-
return
|
|
9913
|
+
return !supportsTruecolor();
|
|
9903
9914
|
}
|
|
9904
9915
|
function rgbTo256(r4, g3, b2) {
|
|
9905
9916
|
if (r4 === g3 && g3 === b2) {
|
|
@@ -9926,8 +9937,8 @@ function getColorLimitationNote() {
|
|
|
9926
9937
|
const dim = "\x1B[2m";
|
|
9927
9938
|
const yellow = "\x1B[33m";
|
|
9928
9939
|
const reset = "\x1B[0m";
|
|
9929
|
-
return `${yellow}Note:${reset} ${dim}Using 256-color mode.
|
|
9930
|
-
${dim}For accurate color previews, use
|
|
9940
|
+
return `${yellow}Note:${reset} ${dim}Using 256-color mode. Terminal does not advertise truecolor support.${reset}
|
|
9941
|
+
${dim}For accurate color previews, use a terminal with COLORTERM=truecolor.${reset}`;
|
|
9931
9942
|
}
|
|
9932
9943
|
return null;
|
|
9933
9944
|
}
|
|
@@ -9941,7 +9952,7 @@ function showHelp() {
|
|
|
9941
9952
|
const dim = "\x1B[2m";
|
|
9942
9953
|
const reset = "\x1B[0m";
|
|
9943
9954
|
const help = `
|
|
9944
|
-
rampa v1.1.
|
|
9955
|
+
rampa v1.1.3
|
|
9945
9956
|
Generate mathematically accurate color palettes from a base color
|
|
9946
9957
|
|
|
9947
9958
|
USAGE
|
|
@@ -10179,7 +10190,7 @@ var validFormats = ["hex", "hsl", "rgb", "oklch"];
|
|
|
10179
10190
|
var main = defineCommand({
|
|
10180
10191
|
meta: {
|
|
10181
10192
|
name: "rampa",
|
|
10182
|
-
version: "1.1.
|
|
10193
|
+
version: "1.1.3",
|
|
10183
10194
|
description: "Generate mathematically accurate color palettes from a base color"
|
|
10184
10195
|
},
|
|
10185
10196
|
args: {
|
|
@@ -10504,7 +10515,8 @@ var main = defineCommand({
|
|
|
10504
10515
|
} else if (outputType === "css") {
|
|
10505
10516
|
console.log(formatCss2(ramps));
|
|
10506
10517
|
} else {
|
|
10507
|
-
|
|
10518
|
+
const canShowPreview = args.preview && supportsTruecolor();
|
|
10519
|
+
if (args.preview && !canShowPreview) {
|
|
10508
10520
|
const limitationNote = getColorLimitationNote();
|
|
10509
10521
|
if (limitationNote) {
|
|
10510
10522
|
console.log(limitationNote);
|
|
@@ -10518,7 +10530,7 @@ var main = defineCommand({
|
|
|
10518
10530
|
console.log(`# ${ramp.name}`);
|
|
10519
10531
|
}
|
|
10520
10532
|
ramp.colors.forEach((color) => {
|
|
10521
|
-
if (
|
|
10533
|
+
if (canShowPreview) {
|
|
10522
10534
|
const c4 = chroma_js_default(color);
|
|
10523
10535
|
const [r4, g3, b2] = c4.rgb();
|
|
10524
10536
|
const square = coloredSquare(r4, g3, b2);
|