color

package
v0.2.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 22, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package color provides ANSI color codes for output formatting.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Available

func Available() bool

Available checks if the terminal has a TTY (teletypewriter) available and returns a boolean value indicating if the system's output buffer is capable of color output.

func Black

func Black(input ...any) string

Black applies the black color to the input string(s) and returns it as a raw string. If the current operating system is not Windows and ci is false, it adds the color code before and the reset code after each input string.

func Blue

func Blue(input ...any) string

Blue applies the blue color to the input string(s) and returns it as a raw string. If the current operating system is not Windows and ci is false, it adds the color code before and the reset code after each input string.

func Bold

func Bold(input ...any) string

Bold applies the bold style to the input string(s) and returns it as a raw string. If the current operating system is not Windows and ci is false, it adds the style code before and the reset code after each input string.

func Cyan

func Cyan(input ...any) string

Cyan applies the cyan color to the input string(s) and returns it as a raw string. If the current operating system is not Windows and ci is false, it adds the color code before and the reset code after each input string.

func Default

func Default(input ...any) string

Default applies default color to the input string(s) and returns it as a raw string. If the current operating system is not Windows and ci is false, it adds the color code before and the reset code after each input string.

func Gray

func Gray(input ...any) string

Gray applies the gray color to the input string(s) and returns it as a raw string. If the current operating system is not Windows and ci is false, it adds the color code before and the reset code after each input string.

func Green

func Green(input ...any) string

Green applies the green color to the input string(s) and returns it as a raw string. If the current operating system is not Windows and ci is false, it adds the color code before and the reset code after each input string.

func Italic

func Italic(input ...any) string

Italic applies the italic style to the input string(s) and returns it as a raw string. If the current operating system is not Windows and ci is false, it adds the style code before and the reset code after each input string.

func Overload

func Overload(ansi []byte, input string) string

Overload constructs an ANSI string with the provided ANSI Escape characters and the input string.

func Purple

func Purple(input ...any) string

Purple applies the purple color to the input string(s) and returns it as a raw string. If the current operating system is not Windows and ci is false, it adds the color code before and the reset code after each input string.

func Red

func Red(input ...any) string

Red applies the red color to the input string(s) and returns it as a raw string. If the current operating system is not Windows and ci is false, it adds the color code before and the reset code after each input string.

func White

func White(input ...any) string

White applies the white color to the input string(s) and returns it as a raw string. If the current operating system is not Windows and ci is false, it adds the color code before and the reset code after each input string.

func Yellow

func Yellow(input ...any) string

Yellow applies the yellow color to the input string(s) and returns it as a raw string. If the current operating system is not Windows and ci is false, it adds the color code before and the reset code after each input string.

Types

type ANSI

type ANSI string

func New

func New() *ANSI

New initializes and returns a new ANSI string.

func (*ANSI) Black

func (c *ANSI) Black(input ...any) *ANSI

Black applies the black color to the input string(s) and returns it as an ANSI string. It uses the Black() function from the ANSI package to convert the input to black color. If the current operating system is not Windows and ci is false, it adds the color code before and the reset code after each input string.

func (*ANSI) Blue

func (c *ANSI) Blue(input ...any) *ANSI

Blue applies the blue color to the input string(s) and returns it as an ANSI string. It uses the Blue() function from the ANSI package to convert the input to blue color. If the current operating system is not Windows and ci is false, it adds the color code before and the reset code after each input string.

func (*ANSI) Bold

func (c *ANSI) Bold(input ...any) *ANSI

Bold applies the bold style to the input string(s) and returns it as an ANSI string. It uses the Bold() function from the ANSI package to convert the input to bold style. If the current operating system is not Windows and ci is false, it adds the style code before and the reset code after each input string.

func (*ANSI) Cyan

func (c *ANSI) Cyan(input ...any) *ANSI

Cyan applies the cyan color to the input string(s) and returns it as an ANSI string. It uses the Cyan() function from the ANSI package to convert the input to cyan color. If the current operating system is not Windows and ci is false, it adds the color code before and the reset code after each input string.

func (*ANSI) Default

func (c *ANSI) Default(input ...any) *ANSI

Default applies the default color to the input string(s) and returns it as an ANSI string. It uses the Default() function from the ANSI package to convert the input to default color. If the current operating system is not Windows and ci is false, it adds the color code before and the reset code after each input string.

func (*ANSI) Gray

func (c *ANSI) Gray(input ...any) *ANSI

Gray applies the gray color to the input string(s) and returns it as an ANSI string. It uses the Gray() function from the ANSI package to convert the input to gray color. If the current operating system is not Windows and ci is false, it adds the color code before and the reset code after each input string.

func (*ANSI) Green

func (c *ANSI) Green(input ...any) *ANSI

Green applies the green color to the input string(s) and returns it as an ANSI string. It uses the Green() function from the ANSI package to convert the input to green color. If the current operating system is not Windows and ci is false, it adds the color code before and the reset code after each input string.

func (*ANSI) Italic

func (c *ANSI) Italic(input ...any) *ANSI

Italic applies the italic style to the input string(s) and returns it as an ANSI string. It uses the Italic() function from the ANSI package to convert the input to italic style. If the current operating system is not Windows and ci is false, it adds the style code before and the reset code after each input string.

func (*ANSI) Overload

func (c *ANSI) Overload(ansi []byte, input string) *ANSI

Overload allows passing ANSI Escape characters directly. It constructs an ANSI string with the provided ANSI Escape characters and the input string.

func (*ANSI) Print

func (c *ANSI) Print()

Print writes the ANSI string to the output buffer without a newline character.

func (*ANSI) Purple

func (c *ANSI) Purple(input ...any) *ANSI

Purple applies the purple color to the input string(s) and returns it as an ANSI string. It uses the Purple() function from the ANSI package to convert the input to purple color. If the current operating system is not Windows and ci is false, it adds the color code before and the reset code after each input string.

func (*ANSI) Red

func (c *ANSI) Red(input ...any) *ANSI

Red applies the red color to the input string(s) and returns it as an ANSI string. It uses the Red() function from the ANSI package to convert the input to red color. If the current operating system is not Windows and ci is false, it adds the color code before and the reset code after each input string.

func (*ANSI) String

func (c *ANSI) String() string

String returns the ANSI string as a raw string.

func (*ANSI) White

func (c *ANSI) White(input ...any) *ANSI

White applies the white color to the input string(s) and returns it as an ANSI string. It uses the White() function from the ANSI package to convert the input to white color. If the current operating system is not Windows and ci is false, it adds the color code before and the reset code after each input string.

func (*ANSI) Write

func (c *ANSI) Write()

Write writes the ANSI string to the output buffer with a newline character.

func (*ANSI) Yellow

func (c *ANSI) Yellow(input ...any) *ANSI

Yellow applies the yellow color to the input string(s) and returns it as an ANSI string. It uses the Yellow() function from the ANSI package to convert the input to yellow color. If the current operating system is not Windows and the ci variable is false, it adds the color code before and the reset code after each input string.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL