Skip to content

Commit

Permalink
feat: Profile.Name() (#163)
Browse files Browse the repository at this point in the history
allows to get the profile name, useful for logs/errors.

Signed-off-by: Carlos Alexandro Becker <[email protected]>
  • Loading branch information
caarlos0 authored May 9, 2024
1 parent 3457830 commit 81b8f94
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,21 @@ const (
Ascii //nolint:revive
)

// Name returns the profile name as a string.
func (p Profile) Name() string {
switch p {
case Ascii:
return "Ascii"
case ANSI:
return "ANSI"
case ANSI256:
return "ANSI256"
case TrueColor:
return "TrueColor"
}
return "Unknown"
}

// String returns a new Style.
func (p Profile) String(s ...string) Style {
return Style{
Expand Down

0 comments on commit 81b8f94

Please sign in to comment.