MuseV / mmcm /utils /color_util.py
kevinwang676's picture
Upload folder using huggingface_hub
bb46cbe verified
raw
history blame contribute delete
566 Bytes
from typing import List, Union, Tuple
class PolledColor(object):
def __init__(self, colors: Union[List[Tuple[int, int, int]], List[Tuple[str, str, str]]]) -> None:
"""่ฝฎๆต่ฟ”ๅ›žๅ€™้€‰้ขœ่‰ฒๅˆ—่กจไธญ็š„้ขœ่‰ฒ
Args:
colors (list): ๅ€™้€‰้ขœ่‰ฒๅˆ—่กจ
"""
self.colors = colors
self.cnt = 0
self.n_color = len(colors)
@property
def color(self) -> Union[Tuple[int, int, int], Tuple[str, str, str]]:
color = self.colors[self.cnt % self.n_color]
self.cnt += 1
return color