{"record":{"id":"fa028fa37dfb8d78","repo":"roboflow/supervision","slug":"bgra-values-must-be-in-range-0-255-got-b-g","errorCode":null,"errorMessage":"BGRA values must be in range 0-255, got ({b}, {g}, {r}, {a})","messagePattern":"BGRA values must be in range 0-255, got \\((.+?), (.+?), (.+?), (.+?)\\)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/supervision/draw/color.py","lineNumber":270,"sourceCode":"                element is an integer in the range 0-255.\n\n        Returns:\n            An instance representing the color.\n\n        Raises:\n            ValueError: If any BGRA value is outside the range 0-255.\n\n        Example:\n            ```pycon\n            >>> import supervision as sv\n            >>> sv.Color.from_bgra_tuple((0, 255, 255, 128))\n            Color(r=255, g=255, b=0, a=128)\n\n            ```\n        \"\"\"\n        b, g, r, a = color_tuple\n        if not (0 <= r <= 255 and 0 <= g <= 255 and 0 <= b <= 255 and 0 <= a <= 255):\n            raise ValueError(\n                f\"BGRA values must be in range 0-255, got ({b}, {g}, {r}, {a})\"\n            )\n        return cls(r=r, g=g, b=b, a=a)\n\n    def as_hex(self) -> str:\n        \"\"\"\n        Converts the Color instance to a hex string.\n\n        Returns:\n            The hexadecimal color string. Returns `#RRGGBBAA` if alpha is not 255,\n                otherwise returns `#RRGGBB`.\n\n        Example:\n            ```pycon\n            >>> import supervision as sv\n            >>> sv.Color(r=255, g=255, b=0).as_hex()\n            '#ffff00'\n","sourceCodeStart":252,"sourceCodeEnd":288,"githubUrl":"https://github.com/roboflow/supervision/blob/7f254d9784d4c37e0f03cd89ddee164c8db099c0/src/supervision/draw/color.py#L252-L288","documentation":"Error \"BGRA values must be in range 0-255, got ({b}, {g}, {r}, {a})\" thrown in roboflow/supervision.","triggerScenarios":"Thrown at src/supervision/draw/color.py:270 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass b, g, r, a values each between 0 and 255 to Color.from_bgra.","Validate or clamp values before calling if they come from an external source."],"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-15T22:17:37.221Z"}