MCPcopy Create free account

hub / github.com/gookit/color / functions

Functions460 in github.com/gookit/color

↓ 172 callersMethodPrintln
(a ...any)
quickstart.go:16
↓ 108 callersMethodString
String convert to code string. returns like "32;45;3"
style.go:80
↓ 66 callersMethodPrintf
(format string, a ...any)
quickstart.go:15
↓ 59 callersMethodReset
Reset terminal. alias of the ResetTerminal()
color_rgb.go:179
↓ 57 callersMethodPrint
(a ...any)
quickstart.go:14
↓ 42 callersMethodSprint
(a ...any)
quickstart.go:12
↓ 41 callersMethodCode
Code convert to code string. returns like "32;45;3"
style.go:77
↓ 35 callersMethodSprintf
(format string, a ...any)
quickstart.go:13
↓ 27 callersFunctionRGB
RGB color create. Usage: c := RGB(30,144,255) c := RGB(30,144,255, true) c.Print("message")
color_rgb.go:70
↓ 26 callersFunctionDetectColorLevel
************************************************************* * helper methods for detect color supports *******************************************
detect_env.go:34
↓ 24 callersFunctionmockOsEnvByText
(envText string, fn func())
color_test.go:818
↓ 23 callersFunctionIsSupportColor
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 callersFunctionRenderCode
************************************************************* * render color code *************************************************************/ Ren
color.go:157
↓ 21 callersMethodC256
C256 convert 16 color to 256-color code.
color_16.go:289
↓ 20 callersFunctionRenderString
RenderString render a string with color code. Usage: msg := RenderString("3;32;45", "a message")
color.go:220
↓ 19 callersFunctionIsSupportTrueColor
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 callersFunctionHEX
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 callersMethodIsEmpty
IsEmpty style
style.go:83
↓ 16 callersFunctionIsSupport256Color
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 callersMethodString
String convert to color code string
color_rgb.go:398
↓ 16 callersFunctioncompareVal
equals: return ok ? val1 : val2
utils.go:177
↓ 16 callersFunctiondoPrintV2
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 callersFunctionParseCodeFromAttr
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 callersFunctionresetColorRender
()
color_test.go:754
↓ 14 callersFunctionS256
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 callersFunctionforceOpenColorRender
force open color render for testing
color_test.go:744
↓ 13 callersFunctionClearCode
ClearCode clear color codes. eg: "\033[36;1mText\x1b[0m" -> "Text"
color.go:244
↓ 12 callersFunctionReplaceTag
ReplaceTag parse string, replace color tag and return rendered string
color_tag.go:388
↓ 12 callersFunctionSupportColor
SupportColor Whether the current environment supports color output
color.go:75
↓ 12 callersFunctiondebugf
************************************************************* * helper methods *************************************************************/ is on
utils.go:165
↓ 12 callersFunctionsaveInternalError
(err error)
utils.go:192
↓ 11 callersMethodFullCode
FullCode to color code string with prefix
color_rgb.go:221
↓ 11 callersFunctionIsSupport16Color
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 callersMethodString
String to color code string with prefix. eg: "38;2;204;123;56"
color_rgb.go:224
↓ 11 callersMethodTips
Tips use name as title, only apply style for name
style.go:106
↓ 10 callersFunctionC256
C256 create a color256
color_256.go:71
↓ 10 callersMethodHex
Hex color rgb to hex string. as in "ff0080".
color_rgb.go:213
↓ 9 callersMethodIsBg
IsBg check is background color
color_16.go:349
↓ 9 callersFunctionPrint
************************************************************* * print methods(will auto parse color tags) ******************************************
utils.go:35
↓ 9 callersMethodPrompt
Prompt use name as title, and apply style for message
style.go:113
↓ 9 callersMethodRGB
RGB convert 16 color to 256-color code.
color_16.go:333
↓ 9 callersFunctionRGBFromString
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 callersFunctionRGBToHSV
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 callersFunctionGetStyle
GetStyle get defined style by name
style.go:231
↓ 8 callersFunctionGetTagCode
************************************************************* * helper methods *************************************************************/ GetTag
color_tag.go:499
↓ 8 callersFunctionHSVToRGB
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 callersMethodString
String convert to color code string with prefix. eg: "38;5;12"
color_256.go:135
↓ 8 callersMethodToBg
ToBg always convert bg
color_16.go:323
↓ 8 callersFunctiondoPrintlnV2
new implementation, support render full color code on pwsh.exe, cmd.exe
utils.go:131
↓ 7 callersFunctionGetTheme
GetTheme get defined theme by name
style.go:193
↓ 7 callersMethodIsEmpty
IsEmpty style
color_rgb.go:417
↓ 7 callersMethodIsFg
IsFg check is foreground color
color_16.go:355
↓ 7 callersMethodRender
Render colored text Usage: color.New(color.FgGreen).Render("text") color.New(color.FgGreen, color.BgBlack, color.OpBold).Render("text")
style.go:42
↓ 7 callersFunctionRenderWithSpaces
RenderWithSpaces Render code with spaces. If the number of args is > 1, a space will be added between the args
color.go:201
↓ 6 callersMethodAdd
Add to global styles map
style.go:32
↓ 6 callersFunctionClearTag
ClearTag clear all tag for a string
color_tag.go:487
↓ 6 callersFunctionHexToRgb
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 callersFunctionRgbStrToHslInts
RgbStrToHslInts convert rgb(r,g,b) string to HSL int values.
convert.go:745
↓ 6 callersFunctionRgbToHsl
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 callersMethodString
String convert to code string. eg "35"
color_16.go:346
↓ 6 callersFunctiontestRgbToC256Color
(t *testing.T, name string, c RGBColor, expected uint8)
color_rgb_test.go:234
↓ 5 callersMethodErrorf
Errorf message print
style.go:292
↓ 5 callersFunctionHslIntToRgb
************************************************************** * region HSL <=> RGB color **********************************************************
convert.go:681
↓ 5 callersFunctionIsConsole
IsConsole Determine whether w is one of stderr, stdout, stdin
detect_env.go:225
↓ 5 callersFunctionIsSupportRGBColor
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 callersMethodIsValid
IsValid options
color_16.go:26
↓ 5 callersFunctionNew
New create a custom style Usage: color.New(color.FgGreen).Print("message") equals to: color.Style{color.FgGreen}.Print("message")
style.go:26
↓ 5 callersMethodParse
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 callersFunctionReset
Reset reset console color attributes
color.go:95
↓ 5 callersMethodRgbString
RgbString to color code string without prefix. eg: "204,123,56"
color_rgb.go:216
↓ 5 callersMethodSetBg
SetBg set bg color
color_rgb.go:350
↓ 5 callersMethodSetFg
SetFg set fg color
color_rgb.go:343
↓ 5 callersMethodString
String returns color code string. eg: "32;45;3"
quickstart.go:38
↓ 5 callersMethodToFg
ToFg always convert fg
color_16.go:313
↓ 5 callersFunctiondetectTermColorLevel
detect terminal color support level refer https://github.com/Delta456/box-cli-maker
detect_env.go:42
↓ 4 callersFunctionDisable
Disable disable color output
color.go:101
↓ 4 callersFunctionHEXStyle
HEXStyle create a RGBStyle from HEX color string. Usage: s := HEXStyle("aabbcc", "eee") s.Print("message")
color_rgb.go:310
↓ 4 callersFunctionHslToRgb
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 callersFunctionInnerErrs
InnerErrs info
color.go:146
↓ 4 callersFunctionPrintf
Printf format and print messages
utils.go:40
↓ 4 callersFunctionPrintln
Println messages with new line
utils.go:45
↓ 4 callersMethodPrintln
Println print message with newline
color_rgb.go:379
↓ 4 callersFunctionRgb2basic
Rgb2basic alias of the RgbToAnsi()
convert.go:518
↓ 4 callersMethodSet
Set terminal by rgb/true color code
color_rgb.go:176
↓ 4 callersMethodSetOpts
SetOpts set color options
color_rgb.go:357
↓ 4 callersMethodString
String convert to color code string
color_256.go:265
↓ 4 callersFunctionSupport256Color
Support256Color Whether the current environment supports 256-color output
color.go:78
↓ 4 callersFunctionSupportTrueColor
SupportTrueColor Whether the current environment supports (RGB)True-color output
color.go:81
↓ 4 callersMethodValue
Value return color value
color_256.go:126
↓ 4 callersFunctionmockEnvValue
* var oldStdout, newReader *os.File // Usage: // rewriteStdout() // fmt.Println("Hello, playground") // msg := restoreStdout() func rewriteStdout() {
color_test.go:798
↓ 3 callersFunctionBit8
Bit8 create a color256
color_256.go:68
↓ 3 callersMethodC16
C16 returns the closest approximate 16 (4 bit) color
color_rgb.go:272
↓ 3 callersMethodColor
Color returns the closest approximate 16 (4 bit) color
color_rgb.go:269
↓ 3 callersFunctionColors2code
Colors2code convert colors to code. return like "32;45;3"
convert.go:406
↓ 3 callersFunctionForceColor
ForceColor force open color render
color.go:131
↓ 3 callersFunctionForceOpenColor
ForceOpenColor force open color render
color.go:134
↓ 3 callersFunctionFprintf
Fprintf print format and rendered messages to writer. Notice: will ignore print error
utils.go:59
↓ 3 callersFunctionFprintln
Fprintln print rendered messages line to writer Notice: will ignore print error
utils.go:67
↓ 3 callersFunctionHslInt
HslInt alias of the HSLInt()
color_rgb.go:135
↓ 3 callersMethodIsEmpty
IsEmpty value
color_rgb.go:250
next →1–100 of 460, ranked by callers