AnsiTerminalColor (int encodedColor) { if (encodedColor >= 0 && encodedColor <= MAX_8BIT_COLOR_INDEX) { return new EightBitColor(encodedColor); } else if (encodedColor >= COLOR_CUBE_MIN_INDEX && encodedColor <= 255) { //16-231: 6 × 6 × 6 cube (216 colors): 16 + 36 × r + 6 × g + b (0 ≤ r, g, b ≤ 5) //232-255: grayscale from black to white in 24 steps return new EightBitRGBColor(encodedColor); } return null; }