Get mapping for items to a support color.
(
items: List[str], excluded_colors: Optional[List] = None
)
| 479 | |
| 480 | |
| 481 | def get_color_mapping( |
| 482 | items: List[str], excluded_colors: Optional[List] = None |
| 483 | ) -> Dict[str, str]: |
| 484 | """Get mapping for items to a support color.""" |
| 485 | colors = list(_TEXT_COLOR_MAPPING.keys()) |
| 486 | if excluded_colors is not None: |
| 487 | colors = [c for c in colors if c not in excluded_colors] |
| 488 | color_mapping = {item: colors[i % len(colors)] for i, item in enumerate(items)} |
| 489 | return color_mapping |
| 490 | |
| 491 | |
| 492 | def get_colored_text(text: str, color: str) -> str: |