cmdio: add Bold, Faint, Italic, Underline, Magenta helpers#5360
Merged
Conversation
Add two helpers to the existing Red/Green/etc. set: - Bold renders text in bold (\x1b[1m). The ansiBold constant already existed in color.go but wasn't exposed as a helper. - Dim renders text in dim/faint intensity (\x1b[2m). The ansiDim constant is new. Both gate on the same SupportsStdoutColor capability check as the existing color helpers, so they degrade to plain text in the same conditions. These are useful for command output where colored emphasis would be distracting but visual hierarchy still helps — e.g. bold IDs and command names, dim secondary metadata. Co-authored-by: Isaac
Collaborator
|
Commit: 9177849 |
Align helpers with the constants and SGR nomenclature they reference:
- Rename the previously-added Dim helper to Faint. The underlying
constant is ansiFaint (SGR 2, "Faint, decreased intensity, or dim").
Helpers in this file are named after the SGR descriptor of their
constant (Bold/Red/Green/…), so Faint matches that pattern. The
earlier addition introduced ansiDim as a second constant for the same
byte sequence; drop that and route Faint through ansiFaint, removing
the duplicate.
- Add Italic, Underline, and Magenta helpers. Constants for these
already lived in color.go (and Magenta even had a template binding
via RenderFuncMap), but no Go-callable wrapper. They round out the
basic-16 styles likely to be useful for CLI emphasis without going
to the full fatih/color kitchen sink.
- Add faint and underline bindings to RenderFuncMap so templates can
reach them on the same footing as bold and italic.
- Align the Bold and Faint doc comments with the SGR table phrasing
("increased intensity" / "decreased intensity") so the two read as
paired intensities, matching the spec.
The Hi* set is intentionally left as-is (only HiBlack and HiBlue) —
those have real callers in libs/apps/logstream and the warehouse
picker; the other six bright variants have none.
Co-authored-by: Isaac
simonfaltum
approved these changes
May 28, 2026
denik
pushed a commit
that referenced
this pull request
May 28, 2026
Expose Go-callable wrappers for SGR styles already present as constants in `libs/cmdio/color.go`: `Bold` (1), `Faint` (2), `Italic` (3), `Underline` (4), and `Magenta` (35). Helpers are named after the SGR descriptor of their constant — so `ansiFaint` → `Faint`, matching the rest of the file. Doc comments use the SGR table phrasing so `Bold` and `Faint` read as paired intensities. Also adds `faint` and `underline` bindings to `RenderFuncMap`. Related to #5223. This pull request and its description were written by Isaac.
Collaborator
|
Commit: c8ea3a8 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Expose Go-callable wrappers for SGR styles already present as constants in
libs/cmdio/color.go:Bold(1),Faint(2),Italic(3),Underline(4), andMagenta(35).Helpers are named after the SGR descriptor of their constant — so
ansiFaint→Faint, matching the rest of the file. Doc comments use the SGR table phrasing soBoldandFaintread as paired intensities.Also adds
faintandunderlinebindings toRenderFuncMap.Related to #5223.
This pull request and its description were written by Isaac.