- Notifications
You must be signed in to change notification settings - Fork928
fix: use ANSI colors codes instead of RGB#14665
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
5e308df
86175bf
098d35d
3d13060
5b8fa3b
4ce84a4
a75dbb2
390a7ca
7e6db79
ce913a5
22a2d0b
5e42118
40eb24e
ccf174a
1fbef1d
44c3726
d16f625
1babe96
ff3c392
6d93c56
506aa28
997dc43
24a838d
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -37,17 +37,21 @@ var ( | ||
) | ||
var ( | ||
// ANSI color codes | ||
red = Color("1") | ||
green = Color("2") | ||
yellow = Color("3") | ||
magenta = Color("5") | ||
white = Color("7") | ||
brightBlue = Color("12") | ||
brightMagenta = Color("13") | ||
Comment on lines +41 to +47 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. nit: indicate these are ANSI color codes | ||
) | ||
// Color returns a color for the given string. | ||
func Color(s string) termenv.Color { | ||
colorOnce.Do(func() { | ||
color = termenv.NewOutput(os.Stdout).EnvColorProfile() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Good solution for disabling colors 👍🏻 | ||
if flag.Lookup("test.v") != nil { | ||
// Use a consistent colorless profile in tests so that results | ||
// are deterministic. | ||
@@ -123,42 +127,45 @@ func init() { | ||
DefaultStyles = Styles{ | ||
Code: pretty.Style{ | ||
ifTerm(pretty.XPad(1, 1)), | ||
pretty.FgColor(Color("#ED567A")), | ||
pretty.BgColor(Color("#2C2C2C")), | ||
}, | ||
DateTimeStamp: pretty.Style{ | ||
pretty.FgColor(brightBlue), | ||
}, | ||
Error: pretty.Style{ | ||
pretty.FgColor(red), | ||
}, | ||
Field: pretty.Style{ | ||
pretty.XPad(1, 1), | ||
pretty.FgColor(Color("#FFFFFF")), | ||
pretty.BgColor(Color("#2B2A2A")), | ||
}, | ||
Fuchsia: pretty.Style{ | ||
pretty.FgColor(brightMagenta), | ||
}, | ||
FocusedPrompt: pretty.Style{ | ||
pretty.FgColor(white), | ||
pretty.Wrap("> ", ""), | ||
pretty.FgColor(brightBlue), | ||
}, | ||
Keyword: pretty.Style{ | ||
pretty.FgColor(green), | ||
}, | ||
Placeholder: pretty.Style{ | ||
pretty.FgColor(magenta), | ||
}, | ||
Prompt: pretty.Style{ | ||
pretty.FgColor(white), | ||
pretty.Wrap(" ", ""), | ||
}, | ||
Warn: pretty.Style{ | ||
pretty.FgColor(yellow), | ||
}, | ||
Wrap: pretty.Style{ | ||
pretty.LineWrap(80), | ||
}, | ||
} | ||
} | ||
// ValidateNotEmpty is a helper function to disallow empty inputs! | ||
Uh oh!
There was an error while loading.Please reload this page.