overlay

package
v0.14.1-rc.2 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package overlay provides terminal UI overlay functionality for placing foreground content on top of background content, similar to modal dialogs or popup windows in terminal applications.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Overlay

type Overlay struct {
	// contains filtered or unexported fields
}

Overlay manages the placement of foreground content over background content in terminal applications. It handles sizing, positioning, and text wrapping to create modal-like experiences.

func New

func New(theme *themes.Theme, opts ...OverlayOpt) *Overlay

New creates a new Overlay with the specified theme and optional configuration. The overlay is initialized with default settings and can be customized using the provided [OverlayOpt]s.

func (*Overlay) Place

func (o *Overlay) Place(bg, fg string, widthFraction float64, style lipgloss.Style) string

Place overlays the foreground content on top of the background content. The fg content is positioned in the center of the bg content, with the widthFraction determining how much of the available width should be used. The style is applied to the foreground content for borders, colors, etc.

Content that exceeds the available height will be truncated with a helpful message indicating how to view the full output.

From https://github.com/charmbracelet/lipgloss/pull/102

func (*Overlay) SetSize

func (o *Overlay) SetSize(width, height int)

SetSize sets the size of the view on which the overlay is placed.

type OverlayOpt

type OverlayOpt func(*Overlay)

OverlayOpt is a functional option for configuring an Overlay.

func WithMinHeightPadding

func WithMinHeightPadding(padding int) OverlayOpt

WithMinHeightPadding sets the minimum height padding reserved for overlays.

func WithMinWidth

func WithMinWidth(minWidth int) OverlayOpt

WithMinWidth sets the minimum width of the overlay (in cells).

Jump to

Keyboard shortcuts

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