Skip to content

Commit bbaacae

Browse files
committed
fix(logger,prompts): replace yoctocolors-cjs rgb() with manual ANSI codes
The yoctocolors-cjs package doesn't have an rgb() method. Replace calls to colors.rgb() with manually constructed ANSI escape sequences for RGB colors (ESC[38;2;r;g;bm...ESC[39m). Affects: - src/logger.ts applyColor() function - src/stdio/prompts.ts applyColor() function
1 parent 35d747b commit bbaacae

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/logger.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,10 @@ function applyColor(
132132
// Named color like 'green', 'red', etc.
133133
return (colors as any)[color](text)
134134
}
135-
// RGB tuple [r, g, b]
136-
return colors.rgb(color[0], color[1], color[2])(text)
135+
// RGB tuple [r, g, b] - manually construct ANSI escape codes.
136+
// yoctocolors-cjs doesn't have an rgb() method, so we build it ourselves.
137+
const { 0: r, 1: g, 2: b } = color
138+
return `\u001B[38;2;${r};${g};${b}m${text}\u001B[39m`
137139
}
138140

139141
/**

src/stdio/prompts.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@ function applyColor(text: string, color: ColorValue): string {
2424
// Named color like 'green', 'red', etc.
2525
return (yoctocolorsCjs as any)[color](text)
2626
}
27-
// RGB tuple [r, g, b]
28-
return yoctocolorsCjs.rgb(color[0], color[1], color[2])(text)
27+
// RGB tuple [r, g, b] - manually construct ANSI escape codes.
28+
// yoctocolors-cjs doesn't have an rgb() method, so we build it ourselves.
29+
const { 0: r, 1: g, 2: b } = color
30+
return `\u001B[38;2;${r};${g};${b}m${text}\u001B[39m`
2931
}
3032

3133
// Type definitions

0 commit comments

Comments
 (0)