devtools
b20573fe - Adjust ANSI colors in logs and console for theme legibility (#10060)

Commit
25 days ago
Adjust ANSI colors in logs and console for theme legibility (#10060) * Adjust ANSI colors in logs and console for theme legibility ANSI colors are fixed terminal colors, so some of them (e.g. ansi-black, ansi-white, ansi-bright-white) are effectively invisible against the corresponding light or dark themed background (see #6345). textSpansFromAnsi now takes an optional background color, which all console/logging call sites pass as the theme surface. Foreground colors whose contrast ratio against that background is below 3:1 are blended toward black (on a light background) or white (on a dark background) to restore legibility; sufficiently contrasting colors are left untouched. Background ANSI colors are not adjusted since blending into the surface does not harm legibility. Adds unit tests for the contrast adjustment behavior. Fixes #6345 * Extract magic numbers in _adjustForContrast into named constants Per code review feedback and the DevTools style guide. * Add release note for ANSI color legibility improvements * Remove unnecessary import from utils.dart --------- Co-authored-by: awaisdev5765 <awaisdev5765@users.noreply.github.com> Co-authored-by: Sam Rawlins <sam.rawlins@gmail.com>
Author
Parents
Loading