30 lines
819 B
Python
30 lines
819 B
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
|
|
from typing import Optional, Self, Sequence
|
|
from Utils.Color import Color
|
|
from Utils.Common import Common
|
|
|
|
class PrintTypeModel:
|
|
|
|
def __init__(self:Self,
|
|
names:str|Sequence[str],
|
|
fore:str|int|Sequence[int]|Color,
|
|
back:Optional[str|int|Sequence[int]|Color] = None
|
|
) -> None:
|
|
|
|
self.names:list[str] = []
|
|
self.name:str
|
|
self.fore:Color = Color(fore)
|
|
self.back:Color|None = None if back is None else Color(back)
|
|
|
|
self.add_names(names)
|
|
self.name = self.names[0].upper()
|
|
|
|
def add_names(self:Self, names:str|Sequence[str]) -> None:
|
|
|
|
name:str
|
|
|
|
for name in Common.get_keys(names, self.names):
|
|
if name not in self.names:
|
|
self.names.append(name) |