Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Contrast and readability validation in scenes (litmus-r363)

StatusDone · archived
TypeTask
Prioritynormal
Parent(litmus-2wte)

Ensure scenes expose real readability issues such as low contrast and color blending.

Summary of Changes

Added contrast module to litmus-model with:

  • WCAG 2.1 relative luminance calculation (srgb_to_linear, relative_luminance)
  • contrast_ratio(c1, c2): standard WCAG contrast ratio (1.0 to 21.0)
  • validate_scene_contrast: checks every non-whitespace span in a scene, resolving semantic colors against a theme, with separate thresholds for normal vs bold text
  • validate_theme_readability: convenience function that checks all built-in scenes at WCAG AA level
  • ContrastIssue struct with full location info (scene/line/span), colors, ratio, and threshold