Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
colors is a palette where the index corresponds to a 8 bit terminal color palette (i.e. 256 colors)
Functions ¶
func InitColors ¶
InitColors initializes 'Colors' (the terminal emulator color palette) with 'num' colors. Accepted num values are 8, 16, 256. Returns a boolean indicating success or failure. If 'num' is not one of the accepted values, 256 colors are initialized and false is returned.
Types ¶
type Canvas ¶
type Canvas interface { // Paint renders two pixels at a time - the top (y) and the // bottom (y+1) ones. Paint(topColor, bottomColor uint8) error // NewLine moves the cursor to the next line NewLine() error // Moves the cursor up one line 'count' times. LineUp(count int) error // Sleep sleeps for the specified time. Sleep(delayMS int) error // Close closes the canvas. Close() error }
Canvas is the destination (e.g. stdout vs file) where the image will be rendered.
type FileCanvas ¶
type FileCanvas struct {
// contains filtered or unexported fields
}
FileCanvas exports the image to a shell script that can be executed when required, to render the image.
func NewFileCanvas ¶
func NewFileCanvas(filename string) (*FileCanvas, error)
NewFileCanvas returns a FileCanvas.
func (*FileCanvas) Close ¶
func (fc *FileCanvas) Close() error
func (*FileCanvas) LineUp ¶
func (fc *FileCanvas) LineUp(count int) error
func (*FileCanvas) NewLine ¶
func (fc *FileCanvas) NewLine() error
func (*FileCanvas) Paint ¶
func (fc *FileCanvas) Paint(topColor, bottomColor uint8) error
func (*FileCanvas) Sleep ¶
func (fc *FileCanvas) Sleep(delayMS int) error
type Image ¶
type Image struct { // Path to image file. Filename string // Specify a file name to export the image to a shell script. // For instance, this script can be used to display an image for motd. ExportFilename string // Specify a loop count to animate GIFs more than once or set to 0 to render the first picture only. LoopCount int //Specify a decimal point multiplier to increase or decrease the speed of the GIF. DelayMultiplier float64 // Use specified width instead of automatically computing it. Height will be calculated according to the aspect ratio. // This is useful in SSH sessions where screen resizes are not registered automatically. UserWidth int // contains filtered or unexported fields }
Image is a representation of a (multi) picture image.
type StdoutCanvas ¶
type StdoutCanvas struct {
// contains filtered or unexported fields
}
StdoutCanvas renders the image to stdout.
func (*StdoutCanvas) Close ¶
func (sc *StdoutCanvas) Close() error
func (*StdoutCanvas) LineUp ¶
func (sc *StdoutCanvas) LineUp(count int) error
func (*StdoutCanvas) NewLine ¶
func (sc *StdoutCanvas) NewLine() error
func (*StdoutCanvas) Paint ¶
func (sc *StdoutCanvas) Paint(topColor, bottomColor uint8) error
func (*StdoutCanvas) Sleep ¶
func (sc *StdoutCanvas) Sleep(delayMS int) error