Spaces:
Sleeping
Sleeping
| from typing import Tuple | |
| # Simple color palette for class-based coloring (RGB) | |
| PALETTE = [ | |
| (235, 64, 52), # red | |
| (52, 152, 219), # blue | |
| (46, 204, 113), # green | |
| (241, 196, 15), # yellow | |
| (155, 89, 182), # purple | |
| (230, 126, 34), # orange | |
| ] | |
| WHITE: Tuple[int, int, int] = (255, 255, 255) | |
| def color_for_label(label: str) -> Tuple[int, int, int]: | |
| """Select a deterministic color for a given class label.""" | |
| idx = abs(hash(label)) % len(PALETTE) | |
| return PALETTE[idx] |