fix(color): eliminate redundant dark: accent modifiers (R-8.29), resolve A-1/A-2/A-9 contrast issues, and implement C11-9 quality gate

This commit is contained in:
2026-08-20 22:42:26 +09:00
parent 7e431de1b7
commit a838af4b94
14 changed files with 190 additions and 69 deletions
+12 -5
View File
@@ -325,9 +325,11 @@ def test_color_contrast_gate():
# AC-44: Verify text-cobalt or text-vermillion (DEFAULT) is not combined with small text sizes
# AC-47: Verify text-white utility usage <= 8 instances
# C11-9 (AC-48): Verify zero dark: modifier usage on accent colors (R-8.29)
white_count = 0
small_size_pattern = re.compile(r'text-(xs|sm|\[0\.65rem\]|\[0\.78rem\])')
default_color_pattern = re.compile(r'(?<!dark:)text-(cobalt|vermillion)(?![a-z-])')
default_color_pattern = re.compile(r'text-(cobalt|vermillion)(?![a-z-])')
dark_accent_pattern = re.compile(r'dark:(?:[a-z:-]*)(cobalt|vermillion)')
for root_dir in [os.path.join(REFER_DIR, "app"), os.path.join(REFER_DIR, "components")]:
for root, _, files in os.walk(root_dir):
@@ -340,11 +342,16 @@ def test_color_contrast_gate():
# AC-47 count
white_count += content.count("text-white")
# AC-44 check line by line
# AC-44 & C11-9 check line by line
for line_idx, line in enumerate(content.splitlines(), start=1):
# C11-9: Zero dark: modifier on accent colors (allow dark:text-ivory / dark:group-open:text-ivory exceptions)
if dark_accent_pattern.search(line):
print(f"❌ C11-9 (AC-48) Violation: Forbidden dark: modifier on accent color at {fpath}:{line_idx}\n {line.strip()}")
return False
if small_size_pattern.search(line) and default_color_pattern.search(line):
# Ignore allowed exceptions (e.g. HeroComposition, Pillar bullets, Vermillion kickers or large titles)
if "Pillar #" in line or "w-1.5 h-1.5" in line or "text-3xl" in line or "text-vermillion" in line:
# Ignore allowed exceptions (e.g. HeroComposition, Pillar bullets, or explicitly exempted titles)
if "Pillar #" in line or "w-1.5 h-1.5" in line or "text-3xl" in line:
continue
print(f"❌ AC-44 Violation: Small text combined with DEFAULT accent color at {fpath}:{line_idx}\n {line.strip()}")
return False
@@ -353,7 +360,7 @@ def test_color_contrast_gate():
print(f"❌ AC-47 Violation: text-white usage count ({white_count}) exceeds whitelist limit (8)")
return False
print(f"✅ Gate 10 PASSED: Color contrast (AC-43), small text routing (AC-44), inversion (AC-45), and text-white count ({white_count}/8, AC-47) verified")
print(f"✅ Gate 10 & 11 PASSED: Color contrast (AC-43), small text routing (AC-44), inversion (AC-45), text-white count ({white_count}/8, AC-47), and dark: accent modifier zero check (C11-9) verified")
return True
def main():