{"record":{"id":"5704613c98d67903","repo":"roboflow/supervision","slug":"color-values-must-be-in-range-0-255-got-self-r","errorCode":null,"errorMessage":"Color values must be in range 0-255, got ({self.r}, {self.g}, {self.b}, {self.a})","messagePattern":"Color values must be in range 0-255, got \\((.+?), (.+?), (.+?), (.+?)\\)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/supervision/draw/color.py","lineNumber":111,"sourceCode":"    | `BLUE`     | `#0000FF`  | `(0, 0, 255)`     |\n    | `YELLOW`   | `#FFFF00`  | `(255, 255, 0)`   |\n    | `ROBOFLOW` | `#A351FB`  | `(163, 81, 251)`  |\n    \"\"\"\n\n    r: int\n    g: int\n    b: int\n    a: int = 255\n\n    def __post_init__(self) -> None:\n        \"\"\"Validate that direct Color construction uses byte-sized channels.\"\"\"\n        if not (\n            0 <= self.r <= 255\n            and 0 <= self.g <= 255\n            and 0 <= self.b <= 255\n            and 0 <= self.a <= 255\n        ):\n            raise ValueError(\n                \"Color values must be in range 0-255, \"\n                f\"got ({self.r}, {self.g}, {self.b}, {self.a})\"\n            )\n\n    @classmethod\n    def from_hex(cls, color_hex: str) -> Color:\n        \"\"\"\n        Create a Color instance from a hex string.\n\n        Args:\n            color_hex: The hex string representing the color. This string can\n                start with '#' followed by 3, 4, 6, or 8 hexadecimal characters.\n                For 3- or 4-character codes, each character is doubled to form the\n                full hex code.\n\n        Returns:\n            An instance representing the color.\n","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/roboflow/supervision/blob/7f254d9784d4c37e0f03cd89ddee164c8db099c0/src/supervision/draw/color.py#L93-L129","documentation":"Error \"Color values must be in range 0-255, got ({self.r}, {self.g}, {self.b}, {self.a})\" thrown in roboflow/supervision.","triggerScenarios":"Thrown at src/supervision/draw/color.py:111 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Construct the color with r, g, b, a values each in the 0-255 range.","Clamp or scale float color values (e.g. multiply 0-1 floats by 255) before constructing the Color."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7f254d9784d4c37e0f03cd89ddee164c8db099c0","analyzedAt":"2026-08-15T05:13:01.950Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}