caption-engine / color_rules.py
cevajosh3-cpu's picture
Create color_rules.py
17e505a verified
Raw History Blame Contribute Delete
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)]