supervision icon indicating copy to clipboard operation
supervision copied to clipboard

fix: add validation for RGB/BGR color values in Color class

Open Shriya613 opened this issue 3 months ago • 1 comments

 ## Description
 This PR adds validation for RGB/BGR color values in the `Color` class to ensure they are within the valid range (0-255).

 ## Changes
 - Added range validation (0-255) to `Color.from_rgb_tuple()` and `Color.from_bgr_tuple()`
 - Raise `ValueError` for invalid color values with descriptive error messages
 - Added comprehensive tests for both valid and invalid cases
 - Updated docstrings to document the new validation behavior

 ## Testing
 - Added test cases for valid RGB/BGR tuples
 - Added test cases for invalid RGB/BGR tuples (out of range values)
 - All tests pass

 ## Related Issues
 Fixes potential issues where invalid color values could cause unexpected behavior in annotators.

Shriya613 avatar Oct 07 '25 21:10 Shriya613

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Oct 07 '25 21:10 CLAassistant