Skip to content

Commit

Permalink
fix: swap order of profiles
Browse files Browse the repository at this point in the history
This makes using custom termenv.Styles behave backwards compatible:
styles don't get stripped from the default profile, only colors.
  • Loading branch information
muesli committed Jun 1, 2022
1 parent fded587 commit 10985ea
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ import (
type Profile int

const (
// Ascii, uncolored profile.
Ascii = Profile(iota) //nolint:revive
// ANSI, 4-bit color profile
ANSI
// TrueColor, 24-bit color profile
TrueColor = Profile(iota)
// ANSI256, 8-bit color profile
ANSI256
// TrueColor, 24-bit color profile
TrueColor
// ANSI, 4-bit color profile
ANSI
// Ascii, uncolored profile
Ascii //nolint:revive
)

// String returns a new Style.
Expand Down Expand Up @@ -51,7 +51,7 @@ func (p Profile) Convert(c Color) Color {
if err != nil {
return nil
}
if p < TrueColor {
if p != TrueColor {
ac := hexToANSI256Color(h)
if p == ANSI {
return ansi256ToANSIColor(ac)
Expand Down

0 comments on commit 10985ea

Please sign in to comment.