box

package
v0.0.0-...-5ae6d54 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Box

type Box struct {
	TopRight    string // TopRight Corner Symbols
	TopLeft     string // TopLeft Corner Symbols
	Vertical    string // Vertical Bar Symbols
	BottomRight string // BottomRight Corner Symbols
	BottomLeft  string // BottomLeft Corner Symbols
	Horizontal  string // Horizontal Bars Symbols
	Config             // Box Config
}

Box defines the design

func New

func New(config Config) Box

New takes Box Config and returns a Box from the given Config

func (Box) Print

func (b Box) Print(title, lines string)

Print prints the Box

func (Box) PrintAlingned

func (b Box) PrintAlingned(title, lines string)

PrintAligned prints the Box after realigning it

func (Box) Println

func (b Box) Println(title, lines string)

Println adds a newline before and after printing the Box

func (Box) PrintlnAligned

func (b Box) PrintlnAligned(title, lines string)

PrintlnAligned prints the Box after realigning it

func (Box) Realign

func (b Box) Realign(title, lines string)

Realigns the Box to the top of the terminal to create the effect of updating the Box

func (Box) String

func (b Box) String(title, lines string) string

String returns the string representation of Box

type Config

type Config struct {
	Py            int         // Horizontal Padding
	Px            int         // Vertical Padding
	ContentAlign  string      // Content Alignment inside Box
	Type          string      // Box Type
	TitlePos      string      // Title Position
	TitleColor    interface{} // Title Color
	ContentColor  interface{} // Content Color
	Color         interface{} // Box Color
	AllowWrapping bool        // Flag to allow custom Content Wrapping
	WrappingLimit int         // Wrap the Content upto the Limit
}

Config is the configuration needed for the Box to be designed

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳