You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
bazarr/libs/pysubs2/common.py

33 lines
614 B

from dataclasses import dataclass
from typing import Union
6 years ago
@dataclass(init=False)
class Color:
6 years ago
"""
8-bit RGB color with alpha channel.
6 years ago
All values are ints from 0 to 255.
"""
r: int
g: int
b: int
a: int = 0
def __init__(self, r: int, g: int, b: int, a: int = 0):
6 years ago
for value in r, g, b, a:
if value not in range(256):
raise ValueError("Color channels must have values 0-255")
self.r = r
self.g = g
self.b = b
self.a = a
6 years ago
#: Version of the pysubs2 library.
VERSION = "1.4.4"
6 years ago
IntOrFloat = Union[int, float]