Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/fatih/color
/ functions
Functions
81 in github.com/fatih/color
⨍
Functions
81
◇
Types & classes
2
↓ 16 callers
Function
colorPrint
(format string, p Attribute, a ...interface{})
color.go:454
↓ 16 callers
Function
colorString
(format string, p Attribute, a ...interface{})
color.go:468
↓ 7 callers
Function
New
New returns a newly created color object.
color.go:117
↓ 6 callers
Method
Print
Print formats using the default formats for its operands and writes to standard output. Spaces are added between operands when neither is a string. It
color.go:216
↓ 6 callers
Method
wrap
wrap wraps the s string with the colors attributes. The string is ready to be printed.
color.go:373
↓ 5 callers
Method
Fprintf
Fprintf formats according to a format specifier and writes to w. It returns the number of bytes written and any write error encountered. On Windows, u
color.go:227
↓ 5 callers
Method
Printf
Printf formats according to a format specifier and writes to standard output. It returns the number of bytes written and any write error encountered.
color.go:237
↓ 5 callers
Method
isNoColorSet
()
color.go:402
↓ 4 callers
Method
Fprint
Fprint formats using the default formats for its operands and writes to w. Spaces are added between operands when neither is a string. It returns the
color.go:204
↓ 4 callers
Method
Set
Set sets the SGR sequence.
color.go:149
↓ 4 callers
Method
Sprintf
Sprintf is just like Printf, but returns a string instead of printing it.
color.go:278
↓ 3 callers
Method
Fprintln
Fprintln formats using the default formats for its operands and writes to w. Spaces are always added between operands and a newline is appended. On Wi
color.go:248
↓ 3 callers
Method
SetWriter
SetWriter is used to set the SGR sequence with the given io.Writer. This is a low-level function, and users should use the higher-level functions, suc
color.go:169
↓ 3 callers
Method
UnsetWriter
UnsetWriter resets all escape attributes and clears the output with the give io.Writer. Usually should be called after SetWriter().
color.go:180
↓ 3 callers
Function
boolPtr
(v bool)
color.go:437
↓ 3 callers
Method
format
()
color.go:381
↓ 3 callers
Function
noColorIsSet
noColorIsSet returns true if the environment variable NO_COLOR is set to a non-empty string.
color.go:39
↓ 3 callers
Method
unset
()
color.go:158
↓ 2 callers
Function
Black
Black is a convenient helper function to print with black foreground. A newline is appended to format by default.
color.go:480
↓ 2 callers
Function
BlackString
BlackString is a convenient helper function to return a string with black foreground.
color.go:512
↓ 2 callers
Function
Blue
Blue is a convenient helper function to print with blue foreground. A newline is appended to format by default.
color.go:496
↓ 2 callers
Function
BlueString
BlueString is a convenient helper function to return a string with blue foreground.
color.go:528
↓ 2 callers
Function
Cyan
Cyan is a convenient helper function to print with cyan foreground. A newline is appended to format by default.
color.go:504
↓ 2 callers
Function
CyanString
CyanString is a convenient helper function to return a string with cyan foreground.
color.go:538
↓ 2 callers
Function
Green
Green is a convenient helper function to print with green foreground. A newline is appended to format by default.
color.go:488
↓ 2 callers
Function
GreenString
GreenString is a convenient helper function to return a string with green foreground.
color.go:520
↓ 2 callers
Function
HiBlack
HiBlack is a convenient helper function to print with hi-intensity black foreground. A newline is appended to format by default.
color.go:546
↓ 2 callers
Function
HiBlackString
HiBlackString is a convenient helper function to return a string with hi-intensity black foreground.
color.go:578
↓ 2 callers
Function
HiBlue
HiBlue is a convenient helper function to print with hi-intensity blue foreground. A newline is appended to format by default.
color.go:562
↓ 2 callers
Function
HiBlueString
HiBlueString is a convenient helper function to return a string with hi-intensity blue foreground.
color.go:600
↓ 2 callers
Function
HiCyan
HiCyan is a convenient helper function to print with hi-intensity cyan foreground. A newline is appended to format by default.
color.go:570
↓ 2 callers
Function
HiCyanString
HiCyanString is a convenient helper function to return a string with hi-intensity cyan foreground.
color.go:610
↓ 2 callers
Function
HiGreen
HiGreen is a convenient helper function to print with hi-intensity green foreground. A newline is appended to format by default.
color.go:554
↓ 2 callers
Function
HiGreenString
HiGreenString is a convenient helper function to return a string with hi-intensity green foreground.
color.go:588
↓ 2 callers
Function
HiMagenta
HiMagenta is a convenient helper function to print with hi-intensity magenta foreground. A newline is appended to format by default.
color.go:566
↓ 2 callers
Function
HiMagentaString
HiMagentaString is a convenient helper function to return a string with hi-intensity magenta foreground.
color.go:604
↓ 2 callers
Function
HiRed
HiRed is a convenient helper function to print with hi-intensity red foreground. A newline is appended to format by default.
color.go:550
↓ 2 callers
Function
HiRedString
HiRedString is a convenient helper function to return a string with hi-intensity red foreground.
color.go:584
↓ 2 callers
Function
HiWhite
HiWhite is a convenient helper function to print with hi-intensity white foreground. A newline is appended to format by default.
color.go:574
↓ 2 callers
Function
HiWhiteString
HiWhiteString is a convenient helper function to return a string with hi-intensity white foreground.
color.go:614
↓ 2 callers
Function
HiYellow
HiYellow is a convenient helper function to print with hi-intensity yellow foreground. A newline is appended to format by default.
color.go:558
↓ 2 callers
Function
HiYellowString
HiYellowString is a convenient helper function to return a string with hi-intensity yellow foreground.
color.go:594
↓ 2 callers
Function
Magenta
Magenta is a convenient helper function to print with magenta foreground. A newline is appended to format by default.
color.go:500
↓ 2 callers
Function
MagentaString
MagentaString is a convenient helper function to return a string with magenta foreground.
color.go:532
↓ 2 callers
Method
Println
Println formats using the default formats for its operands and writes to standard output. Spaces are always added between operands and a newline is ap
color.go:260
↓ 2 callers
Function
Red
Red is a convenient helper function to print with red foreground. A newline is appended to format by default.
color.go:484
↓ 2 callers
Function
RedString
RedString is a convenient helper function to return a string with red foreground.
color.go:516
↓ 2 callers
Method
SprintFunc
SprintFunc returns a new function that returns colorized strings for the given arguments with fmt.Sprint(). Useful to put into or mix into other strin
color.go:336
↓ 2 callers
Function
Unset
Unset resets all escape attributes and clears the output. Usually should be called after Set().
color.go:140
↓ 2 callers
Function
White
White is a convenient helper function to print with white foreground. A newline is appended to format by default.
color.go:508
↓ 2 callers
Function
WhiteString
WhiteString is a convenient helper function to return a string with white foreground.
color.go:542
↓ 2 callers
Function
Yellow
Yellow is a convenient helper function to print with yellow foreground. A newline is appended to format by default.
color.go:492
↓ 2 callers
Function
YellowString
YellowString is a convenient helper function to return a string with yellow foreground.
color.go:524
↓ 2 callers
Function
getCachedColor
(p Attribute)
color.go:441
↓ 1 callers
Method
Add
Add is used to chain SGR parameters. Use as many as parameters to combine and create custom color objects. Example: Add(color.FgRed, color.Underline).
color.go:194
↓ 1 callers
Method
DisableColor
DisableColor disables the color output. Useful to not change any existing code and still being able to output. Can be used for flags like "--no-color"
color.go:392
↓ 1 callers
Method
Equals
Equals returns a boolean value indicating whether two colors are equal.
color.go:413
↓ 1 callers
Method
FprintFunc
FprintFunc returns a new function that prints the passed arguments as colorized with color.Fprint().
color.go:284
↓ 1 callers
Method
PrintfFunc
PrintfFunc returns a new function that prints the passed arguments as colorized with color.Printf().
color.go:308
↓ 1 callers
Method
PrintlnFunc
PrintlnFunc returns a new function that prints the passed arguments as colorized with color.Println().
color.go:324
↓ 1 callers
Function
Set
Set sets the given parameters immediately. It will change the color of output with the given SGR parameters until color.Unset() is called.
color.go:132
↓ 1 callers
Method
Sprint
Sprint is just like Print, but returns a string instead of printing it.
color.go:268
↓ 1 callers
Method
SprintfFunc
SprintfFunc returns a new function that returns colorized strings for the given arguments with fmt.Sprintf(). Useful to put into or mix into other str
color.go:345
↓ 1 callers
Method
Sprintln
Sprintln is just like Println, but returns a string instead of printing it.
color.go:273
↓ 1 callers
Method
attrExists
(a Attribute)
color.go:427
↓ 1 callers
Method
sequence
sequence returns a formatted SGR sequence to be plugged into a "\x1b[...m" an example output might be: "1;36" -> bold cyan
color.go:362
↓ 1 callers
Method
unformat
()
color.go:385
Method
EnableColor
EnableColor enables the color output. Use it in conjunction with DisableColor(). Otherwise, this method has no side effects.
color.go:398
Method
FprintfFunc
FprintfFunc returns a new function that prints the passed arguments as colorized with color.Fprintf().
color.go:300
Method
FprintlnFunc
FprintlnFunc returns a new function that prints the passed arguments as colorized with color.Fprintln().
color.go:316
Method
PrintFunc
PrintFunc returns a new function that prints the passed arguments as colorized with color.Print().
color.go:292
Method
SprintlnFunc
SprintlnFunc returns a new function that returns colorized strings for the given arguments with fmt.Sprintln(). Useful to put into or mix into other s
color.go:354
Function
TestColor
Testing colors is kinda different. First we test for given colors and their escaped formatted results. Next we create some visual tests to be tested.
color_test.go:15
Function
TestColorEquals
(t *testing.T)
color_test.go:72
Function
TestColorVisual
(t *testing.T)
color_test.go:237
Function
TestNoColor
(t *testing.T)
color_test.go:106
Function
TestNoColor_Env
(t *testing.T)
color_test.go:160
Function
TestNoFormat
(t *testing.T)
color_test.go:338
Function
TestNoFormatString
(t *testing.T)
color_test.go:388
Function
Test_noColorIsSet
(t *testing.T)
color_test.go:202
Function
init
()
color_windows.go:9