Documentation
¶
Index ¶
- Constants
- Variables
- func ApplyColor(char rune, position float64, totalWidth int, config ColorConfig) string
- func FPrintColoredLines(w io.Writer, lines []FigText, hardblank rune, maxwidth int, align string, ...)
- func FPrintColoredLinesWithOptions(w io.Writer, lines []FigText, hardblank rune, maxwidth int, ...)
- func FPrintColoredMsg(w io.Writer, msg string, f *Font, maxwidth int, s Settings, align string, ...)
- func FPrintColoredMsgWithOptions(w io.Writer, msg string, f *Font, maxwidth int, s Settings, ...)
- func FPrintLines(w io.Writer, lines []FigText, hardblank rune, maxwidth int, align string)
- func FPrintLinesWithOptions(w io.Writer, lines []FigText, hardblank rune, maxwidth int, ...)
- func FPrintMsg(w io.Writer, msg string, f *Font, maxwidth int, s Settings, align string)
- func FPrintMsgWithOptions(w io.Writer, msg string, f *Font, maxwidth int, s Settings, ...)
- func GuessFontsDirectory() string
- func PrintColoredLines(lines []FigText, hardblank rune, maxwidth int, align string, ...)
- func PrintColoredLinesWithOptions(lines []FigText, hardblank rune, maxwidth int, options PrintOptions, ...)
- func PrintColoredMsg(msg string, f *Font, maxwidth int, s Settings, align string, ...)
- func PrintColoredMsgWithOptions(msg string, f *Font, maxwidth int, s Settings, options PrintOptions, ...)
- func PrintLines(lines []FigText, hardblank rune, maxwidth int, align string)
- func PrintLinesWithOptions(lines []FigText, hardblank rune, maxwidth int, options PrintOptions)
- func PrintMsg(msg string, f *Font, maxwidth int, s Settings, align string)
- func PrintMsgWithOptions(msg string, f *Font, maxwidth int, s Settings, options PrintOptions)
- func SprintMsg(msg string, f *Font, maxwidth int, s Settings, align string) string
- func SprintMsgWithOptions(msg string, f *Font, maxwidth int, s Settings, options PrintOptions) string
- type ColorConfig
- type ColorMode
- type CombinedLoader
- type FigText
- type Font
- type FontLoader
- type Loader
- type PrintOptions
- type RGB
- type Settings
Constants ¶
const ( SMEqual = 1 SMLowLine = 2 SMHierarchy = 4 SMPair = 8 SMBigX = 16 SMHardBlank = 32 SMKern = 64 SMSmush = 128 )
smush modes.
const (
Reset = "\033[0m"
)
ANSI escape codes for colors.
Variables ¶
var (
EmbeddedFonts, _ = fs.Sub(embeddedFonts, "fonts")
)
Functions ¶
func ApplyColor ¶
func ApplyColor(char rune, position float64, totalWidth int, config ColorConfig) string
ApplyColor applies color to a character based on its position and configuration.
func FPrintColoredLines ¶
func FPrintColoredLines(w io.Writer, lines []FigText, hardblank rune, maxwidth int, align string, colorConfig ColorConfig)
FPrintColoredLines prints lines with color support.
func FPrintColoredLinesWithOptions ¶ added in v1.3.0
func FPrintColoredLinesWithOptions(w io.Writer, lines []FigText, hardblank rune, maxwidth int, options PrintOptions, colorConfig ColorConfig)
func FPrintColoredMsg ¶
func FPrintColoredMsg(w io.Writer, msg string, f *Font, maxwidth int, s Settings, align string, colorConfig ColorConfig)
FPrintColoredMsg prints a message with color support.
func FPrintColoredMsgWithOptions ¶ added in v1.3.0
func FPrintColoredMsgWithOptions(w io.Writer, msg string, f *Font, maxwidth int, s Settings, options PrintOptions, colorConfig ColorConfig)
func FPrintLines ¶
func FPrintLinesWithOptions ¶ added in v1.3.0
func FPrintMsgWithOptions ¶ added in v1.3.0
func GuessFontsDirectory ¶
func GuessFontsDirectory() string
func PrintColoredLines ¶
func PrintColoredLines(lines []FigText, hardblank rune, maxwidth int, align string, colorConfig ColorConfig)
PrintColoredLines prints lines with color support to stdout.
func PrintColoredLinesWithOptions ¶ added in v1.3.0
func PrintColoredLinesWithOptions(lines []FigText, hardblank rune, maxwidth int, options PrintOptions, colorConfig ColorConfig)
func PrintColoredMsg ¶
func PrintColoredMsg(msg string, f *Font, maxwidth int, s Settings, align string, colorConfig ColorConfig)
PrintColoredMsg prints a message with color support to stdout.
func PrintColoredMsgWithOptions ¶ added in v1.3.0
func PrintColoredMsgWithOptions(msg string, f *Font, maxwidth int, s Settings, options PrintOptions, colorConfig ColorConfig)
func PrintLinesWithOptions ¶ added in v1.3.0
func PrintLinesWithOptions(lines []FigText, hardblank rune, maxwidth int, options PrintOptions)
func PrintMsgWithOptions ¶ added in v1.3.0
func PrintMsgWithOptions(msg string, f *Font, maxwidth int, s Settings, options PrintOptions)
func SprintMsgWithOptions ¶ added in v1.3.0
Types ¶
type ColorConfig ¶
ColorConfig holds color configuration.
type CombinedLoader ¶
type CombinedLoader struct {
// contains filtered or unexported fields
}
CombinedLoader can access fonts from multiple sources.
func NewCombinedLoader ¶
func NewCombinedLoader(loaders ...*Loader) *CombinedLoader
func NewCombinedLoaderWithDir ¶
func NewCombinedLoaderWithDir(dir string) *CombinedLoader
NewCombinedLoaderWithDir creates a combined loader with external directory and embedded fonts.
func (*CombinedLoader) FontNamesInDir ¶
func (cl *CombinedLoader) FontNamesInDir() ([]string, error)
func (*CombinedLoader) GetFontByName ¶
func (cl *CombinedLoader) GetFontByName(name string) (*Font, error)
type FontLoader ¶
type FontLoader interface {
FontNamesInDir() ([]string, error)
GetFontByName(name string) (*Font, error)
}
FontLoader interface for loading fonts.
type Loader ¶
type Loader struct {
// contains filtered or unexported fields
}
func NewDirLoader ¶
func NewEmbededLoader ¶
func NewEmbededLoader() *Loader
func (*Loader) FontNamesInDir ¶
type PrintOptions ¶ added in v1.3.0
type RGB ¶
type RGB struct {
R, G, B uint8
}
RGB represents a color with red, green, blue components (0-255).
func GetRainbowColor ¶
GetRainbowColor returns a rainbow color based on position (0.0 to 1.0).
func ParseColor ¶
ParseColor parses a color string in various formats: - hex: #FF0000, #ff0000, FF0000, ff0000 - rgb: rgb(255,0,0), RGB(255,0,0) - named colors: red, green, blue, etc.
func (RGB) Interpolate ¶
Interpolate creates a color between two colors based on factor (0.0 to 1.0).