Last 12 weeks · 7 commits
2 of 6 standards met
Set() honors EnableColor() even when the global NoColor autodetection is on, but unset() still called Unset(), which checks the global flag and skipped the reset. Escape sequences were opened and never closed. Write the reset from unset() using the same isNoColorSet() decision as Set(). SetWriter/UnsetWriter were already symmetric. Fixes #230
and currently return only the content byte count, even though color-enabled calls also write an SGR prefix and reset to . Errors from those control-sequence writes are also discarded. Delegate both helpers to the existing / implementations so they follow the byte-count and first-error-stop behavior established in #282. This also fixes the instance-level path that could emit a prefix without its reset when the global value was true. The added tests cover the complete output and returned byte count for both helpers, plus propagation of a prefix write error without continuing to content or reset writes. Tests:
Repository: fatih/color. Description: Color package for Go (golang) Stars: 7997, Forks: 648. Primary language: Go. Languages: Go (100%). License: MIT. Homepage: https://pkg.go.dev/github.com/fatih/color Topics: ansi, color, coloring, go, golang. Latest release: v1.19.0 (6mo ago). Open PRs: 15, open issues: 19. Last activity: 1w ago. Community health: 42%. Top contributors: fatih, dependabot[bot], gregpoirson, pellared, n10v, sashamelentyev, bl-ue, zddhub, ataypamart, pattmax00 and others.