Clamps a color component to the byte range required by SGR truecolor.
int clampRgbChannel(int x) { if (x <= 0) return 0; if (x >= 0xff) return 0xff; return x; }