Spaces:
Sleeping
Sleeping
Download color_rules.py from cevajosh3-cpu/caption-engine: direct link, hf CLI and curl.
- Browser
- Download file 1.84 kB
-
https://huggingface.co/spaces/cevajosh3-cpu/caption-engine/resolve/main/color_rules.py
- Command line
-
hf download hf://spaces/cevajosh3-cpu/caption-engine/color_rules.py
-
curl -L -o color_rules.py https://huggingface.co/spaces/cevajosh3-cpu/caption-engine/resolve/main/color_rules.py
1.84 kB
| # Separate Creator Color Engine for Subtitles | |
| # Color format used: ASS Hex Matrix Format &H00BBGGRR (Blue, Green, Red) | |
| COLOR_PALETTE = { | |
| "YELLOW": "&H0000FFFF", # Bright Creator Yellow | |
| "GREEN": "&H0000FF00", # MrBeast Neon Green | |
| "RED": "&H000000FF", # High-Impact Red | |
| "PINK": "&H00CC00FF", # Viral Shock Pink | |
| "WHITE": "&H00FFFFFF" # Base Fill White | |
| } | |
| def get_word_color(word_text, word_index): | |
| clean_word = word_text.strip().upper().replace(",", "").replace(".", "").replace("!", "") | |
| # π΄ Hardcoded Priority RED Words (Negative/High Impact) | |
| if clean_word in ["STOP", "FREEZE", "WRONG", "BAD", "FAIL", "NO", "DON'T", "NEVER", "BUT", "HATE"]: | |
| return COLOR_PALETTE["RED"] | |
| # π’ Hardcoded Priority GREEN Words (Money/Value) | |
| if clean_word in ["MONEY", "CASH", "WIN", "BEST", "PERFECT", "FAST", "SMART", "MAKE", "MAKING", "FREE", "RICH"]: | |
| return COLOR_PALETTE["GREEN"] | |
| # π‘ Hardcoded Priority YELLOW Words (Time/Action Hooks) | |
| if clean_word in ["YOU", "NOW", "START", "NEED", "LOOK", "LISTEN", "THIS", "WAIT", "WATCH", "GO", "DO"]: | |
| return COLOR_PALETTE["YELLOW"] | |
| # π Hardcoded Priority PINK Words (Viral/Shock Hooks) | |
| if clean_word in ["VIRAL", "INSANE", "SHOCKING", "SECRET", "WHAT", "CRAZY", "WOW", "AMAZING", "BROKE", "MYSTERY"]: | |
| return COLOR_PALETTE["PINK"] | |
| # π AUTOMATIC ROTATION ENGINE: | |
| # If the word isn't in the priority lists, it automatically cycles colors | |
| # so that almost every sentence is fully color-coded! | |
| rotation_pool = [ | |
| COLOR_PALETTE["WHITE"], | |
| COLOR_PALETTE["YELLOW"], | |
| COLOR_PALETTE["GREEN"], | |
| COLOR_PALETTE["PINK"], | |
| COLOR_PALETTE["WHITE"], | |
| COLOR_PALETTE["RED"] | |
| ] | |
| return rotation_pool[word_index % len(rotation_pool)] | |