mirror of
https://seed.radicle.dev/rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5.git
synced 2026-11-29 22:10:31 +08:00
The NO_COLOR convention (https://no-color.org) only calls for suppressing ANSI *color* codes. It does not demand the removal of other attributes such as bold, italic, underline or reverse. Previously, Paint::is_enabled() bundled anstyle_query::no_color() into the single boolean that decides whether to emit any formatting. Because Paint relies on that boolean alone, NO_COLOR ended up stripping bold, italic, reverse, etc. alongside the color codes. That conflates two concerns: terminal styling support and color suppression. It is also contrary to the intent of the standard. Instead, treat the general style decision separately from the color decision. Remove the no_color() check from is_enabled() and add Paint::is_styling_enabled() for the coarse terminal gate. Style::fmt_prefix and fmt_suffix now query NO_COLOR directly and conditionally drop foreground and background codes while preserving non-colour properties. This way bold, italic, underline and the like continue to work when NO_COLOR is set, while colors alone are suppressed. Closes: rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5/cob/xyz.radicle.issue/f922d90 Assisted-by: Pi:deepinfra/moonshotai/Kimi-K2.6 Signed-off-by: Richard Levitte <richard@levitte.org>