Created
March 11, 2026 17:27
-
-
Save pythonhacker/2ce96de2ffb4fe237680b6a82235ab69 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from dataclasses import dataclass | |
| @dataclass(frozen=True) | |
| class ColorData: | |
| r: int = 0 | |
| g: int = 0 | |
| b: int = 0 | |
| def __post_init__(self): | |
| for v in (self.r, self.g, self.b): | |
| if not 0 <= v <= 255: | |
| raise ValueError("RGB must be 0..255") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment