protocol ColorfulStringRenders a Showable value inside ANSI SGR styling and a trailing reset.
These helpers always emit escape sequences; they do not detect terminal capabilities or whether output is redirected. The receiver is consumed only to obtain its display string and no nested-style state is preserved.
Methods
consuming func bold() -> String
Prefixes SGR 1 and appends SGR 0 around the receiver's display text.
View Source
consuming func bold() -> String {
wrap(string: self.show(), code: "1")
}consuming func green() -> String
Prefixes SGR 32 and appends SGR 0 around the receiver's display text.
View Source
consuming func green() -> String {
wrap(string: self.show(), code: "32")
}consuming func red() -> String
Prefixes SGR 31 and appends SGR 0 around the receiver's display text.
View Source
consuming func red() -> String {
wrap(string: self.show(), code: "31")
}