movis.subtitle.rgb_to_ass_color#

movis.subtitle.rgb_to_ass_color(color: str | tuple[int, int, int] | Sequence[int]) str[source]#

Transform the rgb array into the string used in ASS file.

Args:
color:

A union type that can be either a string or a tuple containing RGB integers or a sequence of integers. If str: The string can be either a CSS color name (e.g., ‘red’) or a hexadecimal RGB string (e.g., '#FF0000'). If tuple[int, int, int] or Sequence[int], it represents RGB values as integers between 0 and 255 (e.g., (255, 0, 0)).

Returns:

the color string used in ASS file.

Example:
>>> import movis as mv
>>> mv.rgb_to_ass_color((255, 0, 0))
'&H0000ff'
>>> mv.rgb_to_ass_color('blue')
'&Hff0000'