Documentation
¶
Overview ¶
Package overlay provides functionality for compositing text-based UI elements with positioning support. I copied this package from https://github.com/rmhubbert/bubbletea-overlay
Index ¶
- Variables
- func Clamp(v, lower, upper int) int
- func Composite(fg, bg string, xPos, yPos Position, xOff, yOff int) string
- func Lines(s string) []string
- func Offsets(fg, bg string, xPos, yPos Position, xOff, yOff int) (int, int)
- func PrintHorizontalBorder(height, totalLineCount int, scrollPercent float64) (leftBorder, rightBorder string)
- func PrintVerticalBorder(width int) (topBorder, bottomBorder string)
- func RenderSeparator() string
- func ThumbHeightFromProgress(height, TotalLine int) int
- func Whitespace(length int) string
- type Position
Constants ¶
This section is empty.
Variables ¶
var BlueColor = strconv.Itoa(4 + 0)
var BoldStyle = lipgloss.NewStyle().Bold(true)
var BoxStyle = lipgloss.NewStyle().Border(lipgloss.RoundedBorder())
var Formatter = colorjson.Formatter{ Indent: 2, KeyColor: color.New(color.FgBlue), StringColor: color.New(color.FgGreen), NumberColor: color.New(color.FgCyan), BoolColor: color.New(color.FgYellow), }
var GrayColor = strconv.Itoa(8 + 0)
var GreenColor = strconv.Itoa(2 + 0)
var Line = lipgloss.NewStyle().Border(lipgloss.NormalBorder()).BorderRight(true).BorderLeft(false).BorderTop(false).BorderBottom(false)
var OrangeColor = strconv.Itoa(3 + 0)
var PurpleColor = strconv.Itoa(5 + 0)
var RedColor = strconv.Itoa(1 + 0)
var WhiteColor = strconv.Itoa(7 + 0)
Functions ¶
func Composite ¶
Composite merges and flattens the background and foreground views into a single view. This implementation is based off of the one used by Superfile - https://github.com/yorukot/superfile/blob/main/src/pkg/string_function/overplace.go
func Lines ¶
Lines normalises any non standard new lines within a string, and then splits and returns a slice of strings split on the new lines.
func Offsets ¶
Offsets calculates the actual vertical and horizontal offsets used to position the foreground relative to the background.
func PrintHorizontalBorder ¶
func PrintVerticalBorder ¶
func RenderSeparator ¶
func RenderSeparator() string
func ThumbHeightFromProgress ¶
func Whitespace ¶
Whitespace returns a string of whitespace characters of the requested length.