roboflow/supervision · error · ValueError
RGB values must be in range 0-255, got ({r}, {g}, {b})
Error message
RGB values must be in range 0-255, got ({r}, {g}, {b}) What it means
Error "RGB values must be in range 0-255, got ({r}, {g}, {b})" thrown in roboflow/supervision.
Source
Thrown at src/supervision/draw/color.py:184
element is an integer in the range 0-255.
Returns:
An instance representing the color.
Raises:
ValueError: If any RGB value is outside the range 0-255.
Example:
```pycon
>>> import supervision as sv
>>> sv.Color.from_rgb_tuple((255, 255, 0))
Color(r=255, g=255, b=0)
```
"""
r, g, b = color_tuple
if not (0 <= r <= 255 and 0 <= g <= 255 and 0 <= b <= 255):
raise ValueError(f"RGB values must be in range 0-255, got ({r}, {g}, {b})")
return cls(r=r, g=g, b=b)
@classmethod
def from_bgr_tuple(cls, color_tuple: tuple[int, int, int]) -> Color:
"""
Create a Color instance from a BGR tuple.
Args:
color_tuple: A tuple representing the color in BGR format, where each
element is an integer in the range 0-255.
Returns:
An instance representing the color.
Raises:
ValueError: If any BGR value is outside the range 0-255.
Example:View on GitHub (pinned to 7f254d9784)
Solutions
- Pass r, g, b values each between 0 and 255 to Color.from_rgb.
- Validate or clamp values before calling if they come from an external source.
When it happens
Trigger: Thrown at src/supervision/draw/color.py:184 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of roboflow/supervision@7f254d9784 (2026-08-15).
Data as JSON: /api/errors/c180de76c3a5df35.
Report an issue: GitHub.