{"record":{"id":"acc00d0f6cd93bfc","repo":"roboflow/supervision","slug":"invalid-length-of-color-hash","errorCode":null,"errorMessage":"Invalid length of color hash","messagePattern":"Invalid length of color hash","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/supervision/draw/color.py","lineNumber":60,"sourceCode":"    \"#D2F53C\",\n    \"#FABEBE\",\n    \"#008080\",\n    \"#E6BEFF\",\n    \"#AA6E28\",\n    \"#FFFAC8\",\n    \"#800000\",\n    \"#AAFFC3\",\n]\n\nROBOFLOW_COLOR_PALETTE = [\"C28DFC\", \"A351FB\", \"8315F9\", \"6706CE\", \"5905B3\", \"4D049A\"]\n\n\ndef _validate_color_hex(color_hex: str) -> None:\n    color_hex = color_hex.lstrip(\"#\")\n    if not all(c in \"0123456789abcdefABCDEF\" for c in color_hex):\n        raise ValueError(\"Invalid characters in color hash\")\n    if len(color_hex) not in (3, 4, 6, 8):\n        raise ValueError(\"Invalid length of color hash\")\n\n\n@dataclass\nclass Color:\n    \"\"\"\n    Represents a color in RGBA format.\n\n    This class provides methods to work with colors, including creating colors from hex\n    codes, converting colors to hex strings, RGB tuples, BGR tuples, RGBA tuples,\n    and BGRA tuples.\n\n    Attributes:\n        r: Red channel value (0-255).\n        g: Green channel value (0-255).\n        b: Blue channel value (0-255).\n        a: Alpha channel value (0-255). Default is 255 (fully opaque).\n\n    Example:","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/roboflow/supervision/blob/7f254d9784d4c37e0f03cd89ddee164c8db099c0/src/supervision/draw/color.py#L42-L78","documentation":"Error \"Invalid length of color hash\" thrown in roboflow/supervision.","triggerScenarios":"Thrown at src/supervision/draw/color.py:60 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a hex color string of the correct length: #RGB, #RGBA, #RRGGBB, or #RRGGBBAA.","Strip any trailing characters and verify the string after '#' has 3, 4, 6, or 8 characters."],"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"}