earendil-works/pi · error
Invalid hex color: ${hex}
Error message
Invalid hex color: ${hex} What it means
Error "Invalid hex color: ${hex}" thrown in earendil-works/pi.
Source
Thrown at packages/coding-agent/src/modes/interactive/theme/theme.ts:184
| "userMessageBg"
| "customMessageBg"
| "toolPendingBg"
| "toolSuccessBg"
| "toolErrorBg";
type OptionalThemeColor = "thinkingMax" | "searchMatchText";
type OptionalThemeBg = "scrollbarThumb" | "searchMatchBg";
type ColorMode = "truecolor" | "256color";
// ============================================================================
// Color Utilities
// ============================================================================
function hexToRgb(hex: string): { r: number; g: number; b: number } {
const cleaned = hex.replace("#", "");
if (cleaned.length !== 6) {
throw new Error(`Invalid hex color: ${hex}`);
}
const r = parseInt(cleaned.substring(0, 2), 16);
const g = parseInt(cleaned.substring(2, 4), 16);
const b = parseInt(cleaned.substring(4, 6), 16);
if (Number.isNaN(r) || Number.isNaN(g) || Number.isNaN(b)) {
throw new Error(`Invalid hex color: ${hex}`);
}
return { r, g, b };
}
// The 6x6x6 color cube channel values (indices 0-5)
const CUBE_VALUES = [0, 95, 135, 175, 215, 255];
// Grayscale ramp values (indices 232-255, 24 grays from 8 to 238)
const GRAY_VALUES = Array.from({ length: 24 }, (_, i) => 8 + i * 10);
function findClosestCubeIndex(value: number): number {
let minDist = Infinity;View on GitHub (pinned to 4af9d21d3b)
When it happens
Trigger: Thrown at packages/coding-agent/src/modes/interactive/theme/theme.ts:184 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of earendil-works/pi@4af9d21d3b (2026-08-24).
Data as JSON: /api/errors/f5ac79b9be635b45.
Report an issue: GitHub.