dotfiles bugabingas dorkfiles
owned by bugabinga
README Source History Refs Reviews Compare Notes Search Review guide CI runs test(nugu): make contrast checks a hard gate
dabb767887c0e333786272c78524901c2b42f075
Oliver Jan Krylow <oliver@bugabinga.net > · 8 Jun 2026
unsigned
Browse files Compare with HEAD
Changed files (1) Diff layout Auto Unified Split
+16 / −4 text lines
44 45 const contrast_thresholds = [const contrast_thresholds = [45 46 { color: "error" , bg: "content.backdrop" , min: 4.5 }, { color: "error" , bg: "content.backdrop" , min: 4.5 },46 47 { color: "warning" , bg: "content.backdrop" , min: 3.0 }, { color: "warning" , bg: "content.backdrop" , min: 3.0 },47 48 { color: "info" , bg: "content.backdrop" , min: 2.5 }, { color: "info" , bg: "content.backdrop" , min: 2.5 },
49 + { color: "content.backdrop" , bg: "error" , min: 4.5 },50 + { color: "content.backdrop" , bg: "warning" , min: 4.5 },51 + { color: "content.backdrop" , bg: "info" , min: 4.5 },48 52 { color: "debug" , bg: "content.backdrop" , min: 3.0 }, { color: "debug" , bg: "content.backdrop" , min: 3.0 },49 53 { color: "content.normal" , bg: "content.backdrop" , min: 4.5 }, { color: "content.normal" , bg: "content.backdrop" , min: 4.5 },50 54 { color: "content.accent" , bg: "content.backdrop" , min: 4.5 }, { color: "content.accent" , bg: "content.backdrop" , min: 4.5 },94 98 print $"(ansi yellow_bold)WCAG AA: ($theme_name) theme(ansi reset)" print $"(ansi yellow_bold)WCAG AA: ($theme_name) theme(ansi reset)" 96 - if ($failures | length) > 0 {100 + let failure_count = ($failures | length)102 + if $failure_count > 0 {97 103 for f in $failures { for f in $failures {98 104 print $" (ansi red)✗(ansi reset) ($f.color) ($f.hex) on ($f.bg_hex) — ($f.ratio):1, need ($f.min):1" print $" (ansi red)✗(ansi reset) ($f.color) ($f.hex) on ($f.bg_hex) — ($f.ratio):1, need ($f.min):1" 100 - print $" (ansi red_bold)($failures | length) warnings (ansi reset)" 106 + print $" (ansi red_bold)($failure_count) failures(ansi reset)" 102 108 print $" (ansi green)✓ all colors pass(ansi reset)" print $" (ansi green)✓ all colors pass(ansi reset)" 107 114 export def check [] {export def check [] {109 - validate-theme (new) "dark" 110 - validate-theme (new --light) "light" 116 + let failure_count = ([117 + ( validate-theme (new) "dark" ) 118 + ( validate-theme (new --light) "light" ) 120 + if $failure_count > 0 {121 + error make { msg: $"($failure_count) Nugu contrast checks failed" }113 125 def readable-textcolor [bg: string] {def readable-textcolor [bg: string] {