Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/gookit/color
/ functions
Functions
460 in github.com/gookit/color
⨍
Functions
460
◇
Types & classes
16
↓ 172 callers
Method
Println
(a ...any)
quickstart.go:16
↓ 108 callers
Method
String
String convert to code string. returns like "32;45;3"
style.go:80
↓ 66 callers
Method
Printf
(format string, a ...any)
quickstart.go:15
↓ 59 callers
Method
Reset
Reset terminal. alias of the ResetTerminal()
color_rgb.go:179
↓ 57 callers
Method
Print
(a ...any)
quickstart.go:14
↓ 42 callers
Method
Sprint
(a ...any)
quickstart.go:12
↓ 41 callers
Method
Code
Code convert to code string. returns like "32;45;3"
style.go:77
↓ 35 callers
Method
Sprintf
(format string, a ...any)
quickstart.go:13
↓ 27 callers
Function
RGB
RGB color create. Usage: c := RGB(30,144,255) c := RGB(30,144,255, true) c.Print("message")
color_rgb.go:70
↓ 26 callers
Function
DetectColorLevel
************************************************************* * helper methods for detect color supports *******************************************
detect_env.go:34
↓ 24 callers
Function
mockOsEnvByText
(envText string, fn func())
color_test.go:818
↓ 23 callers
Function
IsSupportColor
IsSupportColor check current console is support color. NOTICE: The method will detect terminal info each times, if only want to get current color l
detect_env.go:245
↓ 23 callers
Function
RenderCode
************************************************************* * render color code *************************************************************/ Ren
color.go:157
↓ 21 callers
Method
C256
C256 convert 16 color to 256-color code.
color_16.go:289
↓ 20 callers
Function
RenderString
RenderString render a string with color code. Usage: msg := RenderString("3;32;45", "a message")
color.go:220
↓ 19 callers
Function
IsSupportTrueColor
IsSupportTrueColor render check. NOTICE: The method will detect terminal info each times, if only want get current color level, please direct call
detect_env.go:283
↓ 17 callers
Function
HEX
HEX create RGB color from a HEX color string. Usage: c := HEX("ccc") // rgb: [204 204 204] c := HEX("aabbcc") // rgb: [170 187 204] c := HEX("#aa
color_rgb.go:102
↓ 16 callers
Method
IsEmpty
IsEmpty style
style.go:83
↓ 16 callers
Function
IsSupport256Color
IsSupport256Color render check NOTICE: The method will detect terminal info each times, if only want to get current color level, please direct call
detect_env.go:262
↓ 16 callers
Method
String
String convert to color code string
color_rgb.go:398
↓ 16 callers
Function
compareVal
equals: return ok ? val1 : val2
utils.go:177
↓ 16 callers
Function
doPrintV2
Uint8sToInts convert []uint8 to []int func Uint8sToInts(u8s []uint8 ) []int { ints := make([]int, len(u8s)) for i, u8 := range u8s { ints[i] = int
utils.go:125
↓ 15 callers
Function
ParseCodeFromAttr
ParseCodeFromAttr parse color attributes. attr format: // VALUE please see var: FgColors, BgColors, AllOptions "fg=VALUE;bg=VALUE;op=VALUE" 16 co
color_tag.go:421
↓ 15 callers
Function
resetColorRender
()
color_test.go:754
↓ 14 callers
Function
S256
S256 create a color256 style Usage: s := color.S256() s := color.S256(132) // fg s := color.S256(132, 203) // fg and bg
color_256.go:192
↓ 14 callers
Function
forceOpenColorRender
force open color render for testing
color_test.go:744
↓ 13 callers
Function
ClearCode
ClearCode clear color codes. eg: "\033[36;1mText\x1b[0m" -> "Text"
color.go:244
↓ 12 callers
Function
ReplaceTag
ReplaceTag parse string, replace color tag and return rendered string
color_tag.go:388
↓ 12 callers
Function
SupportColor
SupportColor Whether the current environment supports color output
color.go:75
↓ 12 callers
Function
debugf
************************************************************* * helper methods *************************************************************/ is on
utils.go:165
↓ 12 callers
Function
saveInternalError
(err error)
utils.go:192
↓ 11 callers
Method
FullCode
FullCode to color code string with prefix
color_rgb.go:221
↓ 11 callers
Function
IsSupport16Color
IsSupport16Color check current console is support color. NOTICE: The method will detect terminal info each times, if only want to get current color
detect_env.go:252
↓ 11 callers
Method
String
String to color code string with prefix. eg: "38;2;204;123;56"
color_rgb.go:224
↓ 11 callers
Method
Tips
Tips use name as title, only apply style for name
style.go:106
↓ 10 callers
Function
C256
C256 create a color256
color_256.go:71
↓ 10 callers
Method
Hex
Hex color rgb to hex string. as in "ff0080".
color_rgb.go:213
↓ 9 callers
Method
IsBg
IsBg check is background color
color_16.go:349
↓ 9 callers
Function
Print
************************************************************* * print methods(will auto parse color tags) ******************************************
utils.go:35
↓ 9 callers
Method
Prompt
Prompt use name as title, and apply style for message
style.go:113
↓ 9 callers
Method
RGB
RGB convert 16 color to 256-color code.
color_16.go:333
↓ 9 callers
Function
RGBFromString
RGBFromString create RGB color from a string. Support use color name in the {namedRgbMap} Usage: c := RGBFromString("170,187,204") c.Print("messag
color_rgb.go:150
↓ 9 callers
Function
RGBToHSV
RGBToHSV Convert RGB values to HSV values - inputs: r, g, b (0-255) - returns: h (0-360), s (0-1.0), v (0-1.0)
convert.go:956
↓ 8 callers
Function
GetStyle
GetStyle get defined style by name
style.go:231
↓ 8 callers
Function
GetTagCode
************************************************************* * helper methods *************************************************************/ GetTag
color_tag.go:499
↓ 8 callers
Function
HSVToRGB
HSVToRGB Convert HSV values to RGB values - inputs: h (0-360), s (0-1.0), v (0-1.0) - returns: r, g, b (0-255)
convert.go:876
↓ 8 callers
Method
String
String convert to color code string with prefix. eg: "38;5;12"
color_256.go:135
↓ 8 callers
Method
ToBg
ToBg always convert bg
color_16.go:323
↓ 8 callers
Function
doPrintlnV2
new implementation, support render full color code on pwsh.exe, cmd.exe
utils.go:131
↓ 7 callers
Function
GetTheme
GetTheme get defined theme by name
style.go:193
↓ 7 callers
Method
IsEmpty
IsEmpty style
color_rgb.go:417
↓ 7 callers
Method
IsFg
IsFg check is foreground color
color_16.go:355
↓ 7 callers
Method
Render
Render colored text Usage: color.New(color.FgGreen).Render("text") color.New(color.FgGreen, color.BgBlack, color.OpBold).Render("text")
style.go:42
↓ 7 callers
Function
RenderWithSpaces
RenderWithSpaces Render code with spaces. If the number of args is > 1, a space will be added between the args
color.go:201
↓ 6 callers
Method
Add
Add to global styles map
style.go:32
↓ 6 callers
Function
ClearTag
ClearTag clear all tag for a string
color_tag.go:487
↓ 6 callers
Function
HexToRgb
HexToRgb convert hex color string to RGB numbers Usage: rgb := HexToRgb("ccc") // rgb: [204 204 204] rgb := HexToRgb("aabbcc") // rgb: [170 187 20
convert.go:438
↓ 6 callers
Function
RgbStrToHslInts
RgbStrToHslInts convert rgb(r,g,b) string to HSL int values.
convert.go:745
↓ 6 callers
Function
RgbToHsl
RgbToHsl Converts an RGB color value to HSL. Conversion formula adapted from http://en.wikipedia.org/wiki/HSL_color_space. e.g: rgb(59, 130, 246) =
convert.go:804
↓ 6 callers
Method
String
String convert to code string. eg "35"
color_16.go:346
↓ 6 callers
Function
testRgbToC256Color
(t *testing.T, name string, c RGBColor, expected uint8)
color_rgb_test.go:234
↓ 5 callers
Method
Errorf
Errorf message print
style.go:292
↓ 5 callers
Function
HslIntToRgb
************************************************************** * region HSL <=> RGB color **********************************************************
convert.go:681
↓ 5 callers
Function
IsConsole
IsConsole Determine whether w is one of stderr, stdout, stdin
detect_env.go:225
↓ 5 callers
Function
IsSupportRGBColor
IsSupportRGBColor check. alias of the IsSupportTrueColor() NOTICE: The method will detect terminal info each times, if only want to get current col
detect_env.go:272
↓ 5 callers
Method
IsValid
IsValid options
color_16.go:26
↓ 5 callers
Function
New
New create a custom style Usage: color.New(color.FgGreen).Print("message") equals to: color.Style{color.FgGreen}.Print("message")
style.go:26
↓ 5 callers
Method
Parse
Parse given string, replace color tag and return rendered string Use built in tags: <TAG_NAME>CONTENT</> // e.g: `<info>message</>` Custom tag at
color_tag.go:339
↓ 5 callers
Function
Reset
Reset reset console color attributes
color.go:95
↓ 5 callers
Method
RgbString
RgbString to color code string without prefix. eg: "204,123,56"
color_rgb.go:216
↓ 5 callers
Method
SetBg
SetBg set bg color
color_rgb.go:350
↓ 5 callers
Method
SetFg
SetFg set fg color
color_rgb.go:343
↓ 5 callers
Method
String
String returns color code string. eg: "32;45;3"
quickstart.go:38
↓ 5 callers
Method
ToFg
ToFg always convert fg
color_16.go:313
↓ 5 callers
Function
detectTermColorLevel
detect terminal color support level refer https://github.com/Delta456/box-cli-maker
detect_env.go:42
↓ 4 callers
Function
Disable
Disable disable color output
color.go:101
↓ 4 callers
Function
HEXStyle
HEXStyle create a RGBStyle from HEX color string. Usage: s := HEXStyle("aabbcc", "eee") s.Print("message")
color_rgb.go:310
↓ 4 callers
Function
HslToRgb
HslToRgb Converts an HSL color value to RGB. Conversion formula adapted from http://en.wikipedia.org/wiki/HSL_color_space. Assumes h, s, and l are con
convert.go:693
↓ 4 callers
Function
InnerErrs
InnerErrs info
color.go:146
↓ 4 callers
Function
Printf
Printf format and print messages
utils.go:40
↓ 4 callers
Function
Println
Println messages with new line
utils.go:45
↓ 4 callers
Method
Println
Println print message with newline
color_rgb.go:379
↓ 4 callers
Function
Rgb2basic
Rgb2basic alias of the RgbToAnsi()
convert.go:518
↓ 4 callers
Method
Set
Set terminal by rgb/true color code
color_rgb.go:176
↓ 4 callers
Method
SetOpts
SetOpts set color options
color_rgb.go:357
↓ 4 callers
Method
String
String convert to color code string
color_256.go:265
↓ 4 callers
Function
Support256Color
Support256Color Whether the current environment supports 256-color output
color.go:78
↓ 4 callers
Function
SupportTrueColor
SupportTrueColor Whether the current environment supports (RGB)True-color output
color.go:81
↓ 4 callers
Method
Value
Value return color value
color_256.go:126
↓ 4 callers
Function
mockEnvValue
* var oldStdout, newReader *os.File // Usage: // rewriteStdout() // fmt.Println("Hello, playground") // msg := restoreStdout() func rewriteStdout() {
color_test.go:798
↓ 3 callers
Function
Bit8
Bit8 create a color256
color_256.go:68
↓ 3 callers
Method
C16
C16 returns the closest approximate 16 (4 bit) color
color_rgb.go:272
↓ 3 callers
Method
Color
Color returns the closest approximate 16 (4 bit) color
color_rgb.go:269
↓ 3 callers
Function
Colors2code
Colors2code convert colors to code. return like "32;45;3"
convert.go:406
↓ 3 callers
Function
ForceColor
ForceColor force open color render
color.go:131
↓ 3 callers
Function
ForceOpenColor
ForceOpenColor force open color render
color.go:134
↓ 3 callers
Function
Fprintf
Fprintf print format and rendered messages to writer. Notice: will ignore print error
utils.go:59
↓ 3 callers
Function
Fprintln
Fprintln print rendered messages line to writer Notice: will ignore print error
utils.go:67
↓ 3 callers
Function
HslInt
HslInt alias of the HSLInt()
color_rgb.go:135
↓ 3 callers
Method
IsEmpty
IsEmpty value
color_rgb.go:250
next →
1–100 of 460, ranked by callers