@mks2508/better-logger 3.0.0 → 4.0.0

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.
Files changed (63) hide show
  1. package/.claude/settings.local.json +3 -1
  2. package/CHANGELOG.json +98 -1
  3. package/dist/Logger.d.ts +24 -12
  4. package/dist/Logger.d.ts.map +1 -1
  5. package/dist/chunks/{Logger-C126NTrD.js → Logger-D-gmmgR2.js} +207 -18
  6. package/dist/chunks/Logger-D-gmmgR2.js.map +1 -0
  7. package/dist/chunks/Logger-D7cfaz15.js +2 -0
  8. package/dist/chunks/Logger-D7cfaz15.js.map +1 -0
  9. package/dist/chunks/{environment-TI2ByCPT.js → environment-COWvu6Wz.js} +466 -98
  10. package/dist/chunks/environment-COWvu6Wz.js.map +1 -0
  11. package/dist/chunks/environment-C_8J-zQ_.js +4 -0
  12. package/dist/chunks/environment-C_8J-zQ_.js.map +1 -0
  13. package/dist/chunks/{formatting-CuNUqGks.js → formatting-CYjT9yhO.js} +2 -2
  14. package/dist/chunks/{formatting-CuNUqGks.js.map → formatting-CYjT9yhO.js.map} +1 -1
  15. package/dist/chunks/{formatting-Blwy-f0W.js → formatting-Cg5YhB9Y.js} +2 -2
  16. package/dist/chunks/{formatting-Blwy-f0W.js.map → formatting-Cg5YhB9Y.js.map} +1 -1
  17. package/dist/core.cjs +1 -1
  18. package/dist/core.js +2 -2
  19. package/dist/exports.cjs +1 -1
  20. package/dist/exports.js +2 -2
  21. package/dist/index.cjs +1 -1
  22. package/dist/index.cjs.map +1 -1
  23. package/dist/index.d.ts +10 -1
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +151 -20
  26. package/dist/index.js.map +1 -1
  27. package/dist/styling.cjs +1 -1
  28. package/dist/styling.js +3 -3
  29. package/dist/terminal/color-converter.d.ts +73 -0
  30. package/dist/terminal/color-converter.d.ts.map +1 -0
  31. package/dist/terminal/formatter.d.ts +20 -0
  32. package/dist/terminal/formatter.d.ts.map +1 -0
  33. package/dist/terminal/terminal-renderer.d.ts +20 -6
  34. package/dist/terminal/terminal-renderer.d.ts.map +1 -1
  35. package/dist/types/core.d.ts +61 -0
  36. package/dist/types/core.d.ts.map +1 -1
  37. package/dist/types/index.d.ts +1 -1
  38. package/dist/types/index.d.ts.map +1 -1
  39. package/dist/utils/environment-detector.d.ts +10 -0
  40. package/dist/utils/environment-detector.d.ts.map +1 -1
  41. package/dist/writers/BufferWriter.d.ts +96 -0
  42. package/dist/writers/BufferWriter.d.ts.map +1 -0
  43. package/dist/writers/index.d.ts +6 -0
  44. package/dist/writers/index.d.ts.map +1 -0
  45. package/package.json +1 -1
  46. package/packages/core/package.json +1 -1
  47. package/packages/styling/package.json +2 -2
  48. package/src/Logger.ts +63 -21
  49. package/src/index.ts +61 -2
  50. package/src/terminal/color-converter.ts +315 -0
  51. package/src/terminal/formatter.ts +236 -0
  52. package/src/terminal/terminal-renderer.ts +74 -79
  53. package/src/types/core.ts +68 -0
  54. package/src/types/index.ts +5 -0
  55. package/src/utils/environment-detector.ts +23 -1
  56. package/src/writers/BufferWriter.ts +157 -0
  57. package/src/writers/index.ts +6 -0
  58. package/dist/chunks/Logger-BCfx_yCK.js +0 -2
  59. package/dist/chunks/Logger-BCfx_yCK.js.map +0 -1
  60. package/dist/chunks/Logger-C126NTrD.js.map +0 -1
  61. package/dist/chunks/environment-Ba5kShbx.js +0 -4
  62. package/dist/chunks/environment-Ba5kShbx.js.map +0 -1
  63. package/dist/chunks/environment-TI2ByCPT.js.map +0 -1
@@ -612,29 +612,389 @@ function getColorCapability() {
612
612
  }
613
613
  return "basic";
614
614
  }
615
+ function getTerminalWidth() {
616
+ if (typeof process !== "undefined" && process.stdout?.columns) {
617
+ return process.stdout.columns;
618
+ }
619
+ return 80;
620
+ }
621
+ function getTerminalHeight() {
622
+ if (typeof process !== "undefined" && process.stdout?.rows) {
623
+ return process.stdout.rows;
624
+ }
625
+ return 24;
626
+ }
627
+ function getEnvironmentInfo() {
628
+ return {
629
+ environment: getEnvironment(),
630
+ supportsANSI: supportsANSI(),
631
+ colorCapability: getColorCapability(),
632
+ isTTY: typeof process !== "undefined" ? Boolean(process.stdout?.isTTY) : false,
633
+ platform: typeof process !== "undefined" ? process.platform : "unknown",
634
+ nodeVersion: typeof process !== "undefined" ? process.versions?.node : null,
635
+ term: typeof process !== "undefined" ? process.env?.TERM : null,
636
+ colorTerm: typeof process !== "undefined" ? process.env?.COLORTERM : null,
637
+ terminalWidth: getTerminalWidth(),
638
+ terminalHeight: getTerminalHeight()
639
+ };
640
+ }
641
+ const ANSI_16_COLORS = {
642
+ black: { fg: "30", bg: "40", bright: { fg: "90", bg: "100" } },
643
+ red: { fg: "31", bg: "41", bright: { fg: "91", bg: "101" } },
644
+ green: { fg: "32", bg: "42", bright: { fg: "92", bg: "102" } },
645
+ yellow: { fg: "33", bg: "43", bright: { fg: "93", bg: "103" } },
646
+ blue: { fg: "34", bg: "44", bright: { fg: "94", bg: "104" } },
647
+ magenta: { fg: "35", bg: "45", bright: { fg: "95", bg: "105" } },
648
+ cyan: { fg: "36", bg: "46", bright: { fg: "96", bg: "106" } },
649
+ white: { fg: "37", bg: "47", bright: { fg: "97", bg: "107" } },
650
+ gray: { fg: "90", bg: "100", bright: { fg: "37", bg: "47" } },
651
+ grey: { fg: "90", bg: "100", bright: { fg: "37", bg: "47" } }
652
+ };
653
+ const CSS_NAMED_COLORS = {
654
+ aliceblue: "#f0f8ff",
655
+ antiquewhite: "#faebd7",
656
+ aqua: "#00ffff",
657
+ aquamarine: "#7fffd4",
658
+ azure: "#f0ffff",
659
+ beige: "#f5f5dc",
660
+ bisque: "#ffe4c4",
661
+ black: "#000000",
662
+ blanchedalmond: "#ffebcd",
663
+ blue: "#0000ff",
664
+ blueviolet: "#8a2be2",
665
+ brown: "#a52a2a",
666
+ burlywood: "#deb887",
667
+ cadetblue: "#5f9ea0",
668
+ chartreuse: "#7fff00",
669
+ chocolate: "#d2691e",
670
+ coral: "#ff7f50",
671
+ cornflowerblue: "#6495ed",
672
+ cornsilk: "#fff8dc",
673
+ crimson: "#dc143c",
674
+ cyan: "#00ffff",
675
+ darkblue: "#00008b",
676
+ darkcyan: "#008b8b",
677
+ darkgoldenrod: "#b8860b",
678
+ darkgray: "#a9a9a9",
679
+ darkgreen: "#006400",
680
+ darkkhaki: "#bdb76b",
681
+ darkmagenta: "#8b008b",
682
+ darkolivegreen: "#556b2f",
683
+ darkorange: "#ff8c00",
684
+ darkorchid: "#9932cc",
685
+ darkred: "#8b0000",
686
+ darksalmon: "#e9967a",
687
+ darkseagreen: "#8fbc8f",
688
+ darkslateblue: "#483d8b",
689
+ darkslategray: "#2f4f4f",
690
+ darkturquoise: "#00ced1",
691
+ darkviolet: "#9400d3",
692
+ deeppink: "#ff1493",
693
+ deepskyblue: "#00bfff",
694
+ dimgray: "#696969",
695
+ dodgerblue: "#1e90ff",
696
+ firebrick: "#b22222",
697
+ floralwhite: "#fffaf0",
698
+ forestgreen: "#228b22",
699
+ fuchsia: "#ff00ff",
700
+ gainsboro: "#dcdcdc",
701
+ ghostwhite: "#f8f8ff",
702
+ gold: "#ffd700",
703
+ goldenrod: "#daa520",
704
+ gray: "#808080",
705
+ green: "#008000",
706
+ greenyellow: "#adff2f",
707
+ honeydew: "#f0fff0",
708
+ hotpink: "#ff69b4",
709
+ indianred: "#cd5c5c",
710
+ indigo: "#4b0082",
711
+ ivory: "#fffff0",
712
+ khaki: "#f0e68c",
713
+ lavender: "#e6e6fa",
714
+ lavenderblush: "#fff0f5",
715
+ lawngreen: "#7cfc00",
716
+ lemonchiffon: "#fffacd",
717
+ lightblue: "#add8e6",
718
+ lightcoral: "#f08080",
719
+ lightcyan: "#e0ffff",
720
+ lightgoldenrodyellow: "#fafad2",
721
+ lightgray: "#d3d3d3",
722
+ lightgreen: "#90ee90",
723
+ lightpink: "#ffb6c1",
724
+ lightsalmon: "#ffa07a",
725
+ lightseagreen: "#20b2aa",
726
+ lightskyblue: "#87cefa",
727
+ lightslategray: "#778899",
728
+ lightsteelblue: "#b0c4de",
729
+ lightyellow: "#ffffe0",
730
+ lime: "#00ff00",
731
+ limegreen: "#32cd32",
732
+ linen: "#faf0e6",
733
+ magenta: "#ff00ff",
734
+ maroon: "#800000",
735
+ mediumaquamarine: "#66cdaa",
736
+ mediumblue: "#0000cd",
737
+ mediumorchid: "#ba55d3",
738
+ mediumpurple: "#9370db",
739
+ mediumseagreen: "#3cb371",
740
+ mediumslateblue: "#7b68ee",
741
+ mediumspringgreen: "#00fa9a",
742
+ mediumturquoise: "#48d1cc",
743
+ mediumvioletred: "#c71585",
744
+ midnightblue: "#191970",
745
+ mintcream: "#f5fffa",
746
+ mistyrose: "#ffe4e1",
747
+ moccasin: "#ffe4b5",
748
+ navajowhite: "#ffdead",
749
+ navy: "#000080",
750
+ oldlace: "#fdf5e6",
751
+ olive: "#808000",
752
+ olivedrab: "#6b8e23",
753
+ orange: "#ffa500",
754
+ orangered: "#ff4500",
755
+ orchid: "#da70d6",
756
+ palegoldenrod: "#eee8aa",
757
+ palegreen: "#98fb98",
758
+ paleturquoise: "#afeeee",
759
+ palevioletred: "#db7093",
760
+ papayawhip: "#ffefd5",
761
+ peachpuff: "#ffdab9",
762
+ peru: "#cd853f",
763
+ pink: "#ffc0cb",
764
+ plum: "#dda0dd",
765
+ powderblue: "#b0e0e6",
766
+ purple: "#800080",
767
+ rebeccapurple: "#663399",
768
+ red: "#ff0000",
769
+ rosybrown: "#bc8f8f",
770
+ royalblue: "#4169e1",
771
+ saddlebrown: "#8b4513",
772
+ salmon: "#fa8072",
773
+ sandybrown: "#f4a460",
774
+ seagreen: "#2e8b57",
775
+ seashell: "#fff5ee",
776
+ sienna: "#a0522d",
777
+ silver: "#c0c0c0",
778
+ skyblue: "#87ceeb",
779
+ slateblue: "#6a5acd",
780
+ slategray: "#708090",
781
+ snow: "#fffafa",
782
+ springgreen: "#00ff7f",
783
+ steelblue: "#4682b4",
784
+ tan: "#d2b48c",
785
+ teal: "#008080",
786
+ thistle: "#d8bfd8",
787
+ tomato: "#ff6347",
788
+ turquoise: "#40e0d0",
789
+ violet: "#ee82ee",
790
+ wheat: "#f5deb3",
791
+ white: "#ffffff",
792
+ whitesmoke: "#f5f5f5",
793
+ yellow: "#ffff00",
794
+ yellowgreen: "#9acd32"
795
+ };
796
+ function hexToRgb(hex) {
797
+ const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
798
+ if (!result || !result[1] || !result[2] || !result[3]) {
799
+ return { r: 255, g: 255, b: 255 };
800
+ }
801
+ return {
802
+ r: parseInt(result[1], 16),
803
+ g: parseInt(result[2], 16),
804
+ b: parseInt(result[3], 16)
805
+ };
806
+ }
807
+ function rgbToHex(r, g, b) {
808
+ return "#" + [r, g, b].map((x) => x.toString(16).padStart(2, "0")).join("");
809
+ }
810
+ function hexTo256(hex) {
811
+ const { r, g, b } = hexToRgb(hex);
812
+ if (r === g && g === b) {
813
+ if (r < 8) return 16;
814
+ if (r > 248) return 231;
815
+ return Math.round((r - 8) / 247 * 24) + 232;
816
+ }
817
+ const ri = Math.round(r / 255 * 5);
818
+ const gi = Math.round(g / 255 * 5);
819
+ const bi = Math.round(b / 255 * 5);
820
+ return 16 + 36 * ri + 6 * gi + bi;
821
+ }
822
+ function colorToHex(color) {
823
+ if (color.startsWith("#")) {
824
+ return color;
825
+ }
826
+ const named = CSS_NAMED_COLORS[color.toLowerCase()];
827
+ if (named) {
828
+ return named;
829
+ }
830
+ const rgbMatch = color.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);
831
+ if (rgbMatch && rgbMatch[1] && rgbMatch[2] && rgbMatch[3]) {
832
+ return rgbToHex(
833
+ parseInt(rgbMatch[1]),
834
+ parseInt(rgbMatch[2]),
835
+ parseInt(rgbMatch[3])
836
+ );
837
+ }
838
+ return "#ffffff";
839
+ }
840
+ function getANSIForeground(color, capability) {
841
+ if (capability === "none") return "";
842
+ const lowerColor = color.toLowerCase();
843
+ if (capability === "basic" && ANSI_16_COLORS[lowerColor]) {
844
+ return `\x1B[${ANSI_16_COLORS[lowerColor].fg}m`;
845
+ }
846
+ if (capability === "basic") {
847
+ const hex2 = colorToHex(color);
848
+ const nearestBasic = findNearestBasicColor(hex2);
849
+ const basicColor = ANSI_16_COLORS[nearestBasic];
850
+ return basicColor ? `\x1B[${basicColor.fg}m` : "\x1B[37m";
851
+ }
852
+ const hex = colorToHex(color);
853
+ const { r, g, b } = hexToRgb(hex);
854
+ return `\x1B[38;2;${r};${g};${b}m`;
855
+ }
856
+ function getANSIBackground(color, capability) {
857
+ if (capability === "none") return "";
858
+ const lowerColor = color.toLowerCase();
859
+ if (capability === "basic" && ANSI_16_COLORS[lowerColor]) {
860
+ return `\x1B[${ANSI_16_COLORS[lowerColor].bg}m`;
861
+ }
862
+ if (capability === "basic") {
863
+ const hex2 = colorToHex(color);
864
+ const nearestBasic = findNearestBasicColor(hex2);
865
+ const basicColor = ANSI_16_COLORS[nearestBasic];
866
+ return basicColor ? `\x1B[${basicColor.bg}m` : "\x1B[47m";
867
+ }
868
+ const hex = colorToHex(color);
869
+ const { r, g, b } = hexToRgb(hex);
870
+ return `\x1B[48;2;${r};${g};${b}m`;
871
+ }
872
+ function getANSI256Foreground(colorIndex) {
873
+ return `\x1B[38;5;${colorIndex}m`;
874
+ }
875
+ function getANSI256Background(colorIndex) {
876
+ return `\x1B[48;5;${colorIndex}m`;
877
+ }
878
+ function findNearestBasicColor(hex) {
879
+ const { r, g, b } = hexToRgb(hex);
880
+ const basicColors = {
881
+ black: { r: 0, g: 0, b: 0 },
882
+ red: { r: 205, g: 0, b: 0 },
883
+ green: { r: 0, g: 205, b: 0 },
884
+ yellow: { r: 205, g: 205, b: 0 },
885
+ blue: { r: 0, g: 0, b: 238 },
886
+ magenta: { r: 205, g: 0, b: 205 },
887
+ cyan: { r: 0, g: 205, b: 205 },
888
+ white: { r: 229, g: 229, b: 229 }
889
+ };
890
+ let nearest = "white";
891
+ let minDistance = Infinity;
892
+ for (const [name, rgb] of Object.entries(basicColors)) {
893
+ const distance = Math.sqrt(
894
+ Math.pow(r - rgb.r, 2) + Math.pow(g - rgb.g, 2) + Math.pow(b - rgb.b, 2)
895
+ );
896
+ if (distance < minDistance) {
897
+ minDistance = distance;
898
+ nearest = name;
899
+ }
900
+ }
901
+ return nearest;
902
+ }
903
+ function extractGradientColors(gradient) {
904
+ const hexMatches = gradient.match(/#[a-fA-F0-9]{6}/g) || [];
905
+ const rgbMatches = gradient.match(/rgba?\([^)]+\)/g) || [];
906
+ const namedMatches = gradient.match(/,\s*([a-z]+)(?:\s|,|\))/gi) || [];
907
+ const colors = [
908
+ ...hexMatches,
909
+ ...rgbMatches.map(colorToHex),
910
+ ...namedMatches.map((m) => {
911
+ const name = m.replace(/[,\s)]/g, "").toLowerCase();
912
+ return CSS_NAMED_COLORS[name] || null;
913
+ }).filter((c) => c !== null)
914
+ ];
915
+ return colors.length > 0 ? colors : ["#ffffff"];
916
+ }
917
+ function gradientToSingleColor(gradient) {
918
+ const colors = extractGradientColors(gradient);
919
+ if (colors.length === 0) return "#ffffff";
920
+ if (colors.length === 1) return colors[0] ?? "#ffffff";
921
+ const rgbs = colors.map((c) => hexToRgb(colorToHex(c)));
922
+ const avgR = Math.round(rgbs.reduce((sum, rgb) => sum + rgb.r, 0) / rgbs.length);
923
+ const avgG = Math.round(rgbs.reduce((sum, rgb) => sum + rgb.g, 0) / rgbs.length);
924
+ const avgB = Math.round(rgbs.reduce((sum, rgb) => sum + rgb.b, 0) / rgbs.length);
925
+ return rgbToHex(avgR, avgG, avgB);
926
+ }
927
+ function cssColorToANSI(cssColor, capability, isBackground = false) {
928
+ if (capability === "none") return "";
929
+ let resolvedColor;
930
+ if (cssColor.includes("gradient")) {
931
+ resolvedColor = gradientToSingleColor(cssColor);
932
+ } else {
933
+ resolvedColor = colorToHex(cssColor);
934
+ }
935
+ return isBackground ? getANSIBackground(resolvedColor, capability) : getANSIForeground(resolvedColor, capability);
936
+ }
937
+ const ANSI = {
938
+ reset: "\x1B[0m",
939
+ bold: "\x1B[1m",
940
+ dim: "\x1B[2m",
941
+ italic: "\x1B[3m",
942
+ underline: "\x1B[4m",
943
+ blink: "\x1B[5m",
944
+ inverse: "\x1B[7m",
945
+ hidden: "\x1B[8m",
946
+ strikethrough: "\x1B[9m",
947
+ fg: {
948
+ black: "\x1B[30m",
949
+ red: "\x1B[31m",
950
+ green: "\x1B[32m",
951
+ yellow: "\x1B[33m",
952
+ blue: "\x1B[34m",
953
+ magenta: "\x1B[35m",
954
+ cyan: "\x1B[36m",
955
+ white: "\x1B[37m",
956
+ gray: "\x1B[90m",
957
+ brightRed: "\x1B[91m",
958
+ brightGreen: "\x1B[92m",
959
+ brightYellow: "\x1B[93m",
960
+ brightBlue: "\x1B[94m",
961
+ brightMagenta: "\x1B[95m",
962
+ brightCyan: "\x1B[96m",
963
+ brightWhite: "\x1B[97m"
964
+ },
965
+ bg: {
966
+ black: "\x1B[40m",
967
+ red: "\x1B[41m",
968
+ green: "\x1B[42m",
969
+ yellow: "\x1B[43m",
970
+ blue: "\x1B[44m",
971
+ magenta: "\x1B[45m",
972
+ cyan: "\x1B[46m",
973
+ white: "\x1B[47m",
974
+ gray: "\x1B[100m",
975
+ brightRed: "\x1B[101m",
976
+ brightGreen: "\x1B[102m",
977
+ brightYellow: "\x1B[103m",
978
+ brightBlue: "\x1B[104m",
979
+ brightMagenta: "\x1B[105m",
980
+ brightCyan: "\x1B[106m",
981
+ brightWhite: "\x1B[107m"
982
+ },
983
+ rgb: (r, g, b) => `\x1B[38;2;${r};${g};${b}m`,
984
+ bgRgb: (r, g, b) => `\x1B[48;2;${r};${g};${b}m`,
985
+ color256: (n) => `\x1B[38;5;${n}m`,
986
+ bgColor256: (n) => `\x1B[48;5;${n}m`
987
+ };
615
988
  class TerminalRenderer {
616
989
  colorCapability;
617
990
  constructor(colorCapability = "full") {
618
991
  this.colorCapability = colorCapability;
619
992
  }
620
993
  /**
621
- * Get ANSI color codes for basic colors
994
+ * Get ANSI color codes - now supports truecolor/256-color
622
995
  */
623
996
  getColorCode(color, background = false) {
624
- const colorCodes = {
625
- "black": { normal: "30", bright: "90" },
626
- "red": { normal: "31", bright: "91" },
627
- "green": { normal: "32", bright: "92" },
628
- "yellow": { normal: "33", bright: "93" },
629
- "blue": { normal: "34", bright: "94" },
630
- "magenta": { normal: "35", bright: "95" },
631
- "cyan": { normal: "36", bright: "96" },
632
- "white": { normal: "37", bright: "97" },
633
- "gray": { normal: "90", bright: "37" },
634
- "grey": { normal: "90", bright: "37" }
635
- };
636
- const codes = colorCodes[color.toLowerCase()] || { normal: "37" };
637
- return `\x1B[${codes.normal}m`;
997
+ return background ? getANSIBackground(color, this.colorCapability) : getANSIForeground(color, this.colorCapability);
638
998
  }
639
999
  /**
640
1000
  * Get ANSI style codes
@@ -762,36 +1122,37 @@ class TerminalRenderer {
762
1122
  return levelMap[level] || String(level).toUpperCase();
763
1123
  }
764
1124
  /**
765
- * Create cyberpunk-style ANSI rendering
1125
+ * Create cyberpunk-style ANSI rendering with truecolor support
766
1126
  */
767
1127
  renderCyberpunk(level, message, timestamp, prefix, location) {
768
- const reset = "\x1B[0m";
769
- const levelColors = {
770
- "debug": "\x1B[95m",
771
- // Bright magenta
772
- "info": "\x1B[94m",
773
- // Bright blue
774
- "warn": "\x1B[93m",
775
- // Bright yellow
776
- "error": "\x1B[91m",
777
- // Bright red
778
- "critical": "\x1B[91m\x1B[1m"
779
- // Bright red + bold
1128
+ const reset = ANSI.reset;
1129
+ const cyberpunkColors = {
1130
+ "debug": "#ff00ff",
1131
+ // Neon magenta
1132
+ "info": "#00ffff",
1133
+ // Neon cyan
1134
+ "warn": "#ffff00",
1135
+ // Neon yellow
1136
+ "error": "#ff0040",
1137
+ // Neon red-pink
1138
+ "critical": "#ff0000"
1139
+ // Pure red
780
1140
  };
781
1141
  const parts = [];
782
1142
  if (timestamp) {
783
- parts.push(`\x1B[90m${timestamp}${reset}`);
1143
+ parts.push(`${ANSI.dim}${timestamp}${reset}`);
784
1144
  }
785
- const levelColor = levelColors[level] || "\x1B[97m";
786
- const bgBlack = "\x1B[40m";
787
- parts.push(`${bgBlack}${levelColor} ${this.getLevelText(level)} ${reset}`);
1145
+ const levelColor = this.getColorCode(cyberpunkColors[level] || "#ffffff");
1146
+ const bgBlack = ANSI.bg.black;
1147
+ const bold = level === "critical" ? ANSI.bold : "";
1148
+ parts.push(`${bgBlack}${levelColor}${bold} ${this.getLevelText(level)} ${reset}`);
788
1149
  if (prefix) {
789
- const bgBlack2 = "\x1B[40m";
790
- parts.push(`${bgBlack2}\x1B[96m[${prefix.toUpperCase()}]${reset}`);
1150
+ const cyanColor = this.getColorCode("#00ffff");
1151
+ parts.push(`${bgBlack}${cyanColor}[${prefix.toUpperCase()}]${reset}`);
791
1152
  }
792
1153
  parts.push(message);
793
1154
  if (location) {
794
- parts.push(`\x1B[90m(${location})${reset}`);
1155
+ parts.push(`${ANSI.dim}(${location})${reset}`);
795
1156
  }
796
1157
  return {
797
1158
  text: parts.join(" "),
@@ -799,30 +1160,32 @@ class TerminalRenderer {
799
1160
  };
800
1161
  }
801
1162
  /**
802
- * Create minimal ANSI rendering
1163
+ * Create minimal ANSI rendering with truecolor support
803
1164
  */
804
1165
  renderMinimal(level, message, timestamp, prefix) {
805
- const reset = "\x1B[0m";
806
- const levelColors = {
807
- "debug": "\x1B[95m",
808
- // Magenta
809
- "info": "\x1B[94m",
810
- // Blue
811
- "warn": "\x1B[93m",
812
- // Yellow
813
- "error": "\x1B[91m",
814
- // Red
815
- "critical": "\x1B[91m\x1B[1m"
816
- // Red + bold
1166
+ const reset = ANSI.reset;
1167
+ const minimalColors = {
1168
+ "debug": "#c678dd",
1169
+ // Soft purple
1170
+ "info": "#61afef",
1171
+ // Soft blue
1172
+ "warn": "#e5c07b",
1173
+ // Soft yellow
1174
+ "error": "#e06c75",
1175
+ // Soft red
1176
+ "critical": "#be5046"
1177
+ // Dark red
817
1178
  };
818
1179
  const parts = [];
819
1180
  if (timestamp) {
820
- parts.push(`\x1B[90m${timestamp}${reset}`);
1181
+ parts.push(`${ANSI.dim}${timestamp}${reset}`);
821
1182
  }
822
- const levelColor = levelColors[level] || "\x1B[97m";
823
- parts.push(`${levelColor}${this.getLevelText(level)}:${reset}`);
1183
+ const levelColor = this.getColorCode(minimalColors[level] || "#abb2bf");
1184
+ const bold = level === "critical" ? ANSI.bold : "";
1185
+ parts.push(`${levelColor}${bold}${this.getLevelText(level)}:${reset}`);
824
1186
  if (prefix) {
825
- parts.push(`\x1B[96m[${prefix.toUpperCase()}]${reset}`);
1187
+ const cyanColor = this.getColorCode("#56b6c2");
1188
+ parts.push(`${cyanColor}[${prefix.toUpperCase()}]${reset}`);
826
1189
  }
827
1190
  parts.push(message);
828
1191
  return {
@@ -831,52 +1194,40 @@ class TerminalRenderer {
831
1194
  };
832
1195
  }
833
1196
  /**
834
- * Get chalk instance for log level (for compatibility with adapter)
1197
+ * Get chalk-like interface for log level with truecolor support
835
1198
  */
836
1199
  getChalkForLevel(level) {
837
1200
  const levelColors = {
838
- "debug": "magenta",
839
- "info": "blue",
840
- "warn": "yellow",
841
- "error": "red",
842
- "critical": "red"
1201
+ "debug": "#c678dd",
1202
+ "info": "#61afef",
1203
+ "warn": "#e5c07b",
1204
+ "error": "#e06c75",
1205
+ "critical": "#be5046"
843
1206
  };
1207
+ const reset = ANSI.reset;
844
1208
  return {
845
1209
  color: (text) => {
846
- const color = levelColors[level] || "white";
1210
+ const color = levelColors[level] || "#abb2bf";
847
1211
  const colorCode = this.getColorCode(color);
848
- return `${colorCode}${text}${"\x1B[0m"}`;
849
- },
850
- bold: (text) => {
851
- const boldStyle = this.getStyleCode(["bold"]);
852
- return `${boldStyle}${text}${"\x1B[0m"}`;
853
- },
854
- dim: (text) => {
855
- const dimStyle = this.getStyleCode(["dim"]);
856
- return `${dimStyle}${text}${"\x1B[0m"}`;
857
- },
858
- bgGray: (text) => {
859
- return `\x1B[100m${text}${"\x1B[0m"}`;
860
- },
861
- bgBlue: (text) => {
862
- return `\x1B[104m${text}${"\x1B[0m"}`;
1212
+ return `${colorCode}${text}${reset}`;
863
1213
  },
1214
+ bold: (text) => `${ANSI.bold}${text}${reset}`,
1215
+ dim: (text) => `${ANSI.dim}${text}${reset}`,
1216
+ bgGray: (text) => `${ANSI.bg.gray}${text}${reset}`,
1217
+ bgBlue: (text) => `${this.getColorCode("#1e3a5f", true)}${text}${reset}`,
864
1218
  reset: (text) => text,
865
1219
  cyan: {
866
1220
  bold: (text) => {
867
- const cyan = this.getColorCode("cyan");
868
- const bold = this.getStyleCode(["bold"]);
869
- return `${cyan}${bold}${text}${"\x1B[0m"}`;
1221
+ const cyan = this.getColorCode("#00ffff");
1222
+ return `${cyan}${ANSI.bold}${text}${reset}`;
870
1223
  },
871
1224
  dim: (text) => {
872
- const cyan = this.getColorCode("cyan");
873
- const dim = this.getStyleCode(["dim"]);
874
- return `${cyan}${dim}${text}${"\x1B[0m"}`;
1225
+ const cyan = this.getColorCode("#00ffff");
1226
+ return `${cyan}${ANSI.dim}${text}${reset}`;
875
1227
  },
876
1228
  bg: (text) => {
877
- const bgBlack = "\x1B[40m";
878
- const cyan = this.getColorCode("cyan");
879
- return `${bgBlack}${cyan}[${text.toUpperCase()}]${"\x1B[0m"}`;
1229
+ const cyan = this.getColorCode("#00ffff");
1230
+ return `${ANSI.bg.black}${cyan}[${text.toUpperCase()}]${reset}`;
880
1231
  }
881
1232
  }
882
1233
  };
@@ -1179,31 +1530,48 @@ function supportsANSIColors() {
1179
1530
  return false;
1180
1531
  }
1181
1532
  export {
1182
- ADAPTIVE_COLORS as A,
1533
+ ANSI as A,
1183
1534
  BUILD_PRESETS as B,
1535
+ getAdaptiveColor as C,
1184
1536
  DEFAULT_CONFIG as D,
1185
1537
  ENVIRONMENT_DETECTION as E,
1538
+ ADAPTIVE_COLORS as F,
1539
+ BUFFER_LIMITS as G,
1540
+ generateLogId as H,
1541
+ parseTimeInput as I,
1542
+ formatDisplayTime as J,
1543
+ safeStringify as K,
1186
1544
  LEVEL_STYLES as L,
1545
+ escapeHtml as M,
1546
+ EXPORT_FORMATS as N,
1547
+ setupThemeChangeListener as O,
1187
1548
  StylePresets as S,
1549
+ TerminalRenderer as T,
1188
1550
  isBrowser as a,
1189
1551
  StyleBuilder as b,
1190
- createStyledOutput as c,
1552
+ hexTo256 as c,
1191
1553
  detectEnvironmentPreset as d,
1192
- supportsANSIColors as e,
1554
+ colorToHex as e,
1193
1555
  formatTimestamp as f,
1194
1556
  getOptimalConfig as g,
1195
- getAdaptiveColor as h,
1557
+ hexToRgb as h,
1196
1558
  isNode as i,
1197
- BUFFER_LIMITS as j,
1198
- generateLogId as k,
1199
- parseTimeInput as l,
1200
- formatDisplayTime as m,
1201
- safeStringify as n,
1202
- escapeHtml as o,
1559
+ getANSIForeground as j,
1560
+ getANSIBackground as k,
1561
+ getANSI256Foreground as l,
1562
+ getANSI256Background as m,
1563
+ cssColorToANSI as n,
1564
+ getEnvironment as o,
1203
1565
  parseStackTrace as p,
1204
- EXPORT_FORMATS as q,
1205
- setupThemeChangeListener as r,
1206
- supportsCSSColors as s,
1207
- getEnvironment as t
1566
+ isRunningInTerminal as q,
1567
+ rgbToHex as r,
1568
+ supportsANSI as s,
1569
+ getColorCapability as t,
1570
+ getTerminalWidth as u,
1571
+ getTerminalHeight as v,
1572
+ getEnvironmentInfo as w,
1573
+ supportsCSSColors as x,
1574
+ createStyledOutput as y,
1575
+ supportsANSIColors as z
1208
1576
  };
1209
- //# sourceMappingURL=environment-TI2ByCPT.js.map
1577
+ //# sourceMappingURL=environment-COWvu6Wz.js.map