roboflow/supervision · error · ValueError

BGR values must be in range 0-255, got ({b}, {g}, {r})

Error message

BGR values must be in range 0-255, got ({b}, {g}, {r})

What it means

Error "BGR values must be in range 0-255, got ({b}, {g}, {r})" thrown in roboflow/supervision.

Source

Thrown at src/supervision/draw/color.py:212

                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:
            ```pycon
            >>> import supervision as sv
            >>> sv.Color.from_bgr_tuple((0, 255, 255))
            Color(r=255, g=255, b=0)

            ```
        """
        b, g, r = color_tuple
        if not (0 <= r <= 255 and 0 <= g <= 255 and 0 <= b <= 255):
            raise ValueError(f"BGR values must be in range 0-255, got ({b}, {g}, {r})")
        return cls(r=r, g=g, b=b)

    @classmethod
    def from_rgba_tuple(cls, color_tuple: tuple[int, int, int, int]) -> Color:
        """
        Create a Color instance from an RGBA tuple.

        Args:
            color_tuple: A tuple representing the color in RGBA format, where each
                element is an integer in the range 0-255.

        Returns:
            An instance representing the color.

        Raises:
            ValueError: If any RGBA value is outside the range 0-255.

        Example:

View on GitHub (pinned to 7f254d9784)

Solutions

  1. Pass b, g, r values each between 0 and 255 to Color.from_bgr.
  2. Validate or clamp values before calling if they come from an external source.

When it happens

Trigger: Thrown at src/supervision/draw/color.py:212 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/57ca6f45f4c4b254. Report an issue: GitHub.