diff --git a/scripts/learn_theme.py b/scripts/learn_theme.py index 93bc77a..40df14a 100644 --- a/scripts/learn_theme.py +++ b/scripts/learn_theme.py @@ -290,6 +290,7 @@ def analyze_styles(grouped: dict) -> dict: # --- primary (accent color) ------------------------------------------------ # Collect non-gray colors from strong/section/h1-h3/span; boost colors from # elements whose font-size is ≥ 20 px (weight × 5). + # Exclude the dominant text color so near-black body text never wins. accent_tags = {"strong", "section", "h1", "h2", "h3", "span"} accent_counter: Counter = Counter() for tag in accent_tags: @@ -300,6 +301,8 @@ def analyze_styles(grouped: dict) -> dict: hex_c = rgb_to_hex(color_val) if is_gray(hex_c): continue + if hex_c == result["text"]: + continue # Check font-size for boost fs = d.get("font-size") fs_px = _parse_px(fs) if fs else None