1package theme23import (4 "image/color"56 "charm.land/lipgloss/v2"78 "src.rest/cat/012/internal/sheet"9)1011// Monochrome returns t with every color of every role replaced by one12// gray, as a terminal without color, or a reader who can't tell the13// colors apart, sees it: what's left to tell states apart is text,14// glyphs and attributes (bold, italic, underline styles, reverse video).15// Tests draw with it to check that every state reads without color (see16// docs/contributing/ux.md#visual-rules).17func Monochrome(t Theme) Theme {18 one := color.RGBA{R: 0x80, G: 0x80, B: 0x80, A: 0xff}19 eachRole(&t, func(_ string, s *lipgloss.Style) {20 if !isNoColor(s.GetForeground()) {21 *s = s.Foreground(one)22 }23 if !isNoColor(s.GetBackground()) {24 *s = s.Background(one)25 }26 if !isNoColor(s.GetUnderlineColor()) {27 *s = s.UnderlineColor(one)28 }29 })30 t.scales, t.shades = map[scaleKey]Shade{}, map[sheet.RuleStyle]Shade{}31 return t32}