console

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2024 License: MIT Imports: 5 Imported by: 4

Documentation

Index

Constants

View Source
const (
	Bold      = "\033[1m"
	Underline = "\033[4m"
)
View Source
const ResetColourSymbol = "\033[0m"

Variables

This section is empty.

Functions

func ErrWrite

func ErrWrite(content ...any)

func ErrWriteF added in v0.0.14

func ErrWriteF(format string, params ...any)

func ErrWriteLine

func ErrWriteLine(content ...any)

func ErrWriteLineF added in v0.0.14

func ErrWriteLineF(format string, params ...any)

func ReadLine

func ReadLine() (string, error)

func ResetColour

func ResetColour()

func Write

func Write(content ...any)

func WriteF added in v0.0.14

func WriteF(format string, params ...any)

func WriteLine

func WriteLine(content ...any)

func WriteLineF added in v0.0.14

func WriteLineF(format string, params ...any)

Types

type Colour

type Colour int
const (
	Black  Colour = 0
	Red    Colour = 1
	Green  Colour = 2
	Yellow Colour = 3
	Blue   Colour = 4
	Purple Colour = 5
	Cyan   Colour = 6
	Gray   Colour = 7
	White  Colour = 67
	None   Colour = -1
)

func (Colour) AsBackground

func (c Colour) AsBackground() PrintConfig

func (Colour) AsForeground

func (c Colour) AsForeground() PrintConfig

func (Colour) Background

func (c Colour) Background() string

func (Colour) Foreground

func (c Colour) Foreground() string

type ColourText

type ColourText struct {
	PrintConfig
	Text string
}

func ColourfulText

func ColourfulText(text string, foreground Colour, background Colour) ColourText

func NewColourText

func NewColourText(text string) ColourText

func (ColourText) String

func (ct ColourText) String() string

type PrintConfig

type PrintConfig struct {
	Foreground Colour
	Background Colour
	Bold       bool
	Underline  bool
}

func (PrintConfig) ConsoleString

func (p PrintConfig) ConsoleString() (cfg string, needReset bool)

func (PrintConfig) ErrWrite

func (p PrintConfig) ErrWrite(format string, params ...interface{})

func (PrintConfig) ErrWriteLine

func (p PrintConfig) ErrWriteLine(format string, params ...interface{})

func (PrintConfig) WithBackground

func (p PrintConfig) WithBackground(c Colour) PrintConfig

func (PrintConfig) WithBold

func (p PrintConfig) WithBold(b bool) PrintConfig

func (PrintConfig) WithForeground

func (p PrintConfig) WithForeground(c Colour) PrintConfig

func (PrintConfig) WithUnderline

func (p PrintConfig) WithUnderline(u bool) PrintConfig

func (PrintConfig) Write

func (p PrintConfig) Write(format string, params ...interface{})

func (PrintConfig) WriteLine

func (p PrintConfig) WriteLine(format string, params ...interface{})

Jump to

Keyboard shortcuts

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