Documentation
¶
Overview ¶
Package display provides functions for styled terminal output.
Package display provides functions for styled terminal output and theme management.
Index ¶
Constants ¶
const ( // None disables all terminal styling. None = "none" // Custom indicates a custom color profile is in use. Custom = "custom" // Auto enables automatic color profile detection. Auto = "auto" // Notty indicates no TTY is available (non-interactive mode). Notty = "notty" // Truecolor indicates a terminal supporting 24-bit true color. Truecolor = "truecolor" // Bit24 is an alias for 24-bit color support. Bit24 = "24bit" )
Theme and terminal color constants used throughout the display package.
const (
// DefaultWordWrapWidth is the default word wrap width for terminal display.
DefaultWordWrapWidth = 120
)
Terminal display layout constants.
Variables ¶
This section is empty.
Functions ¶
func DetermineGlamourStyle ¶
DetermineGlamourStyle returns the Glamour style string to use for markdown rendering based on the provided options, considering color enablement, terminal color support, and the selected theme.
func IsTerminalColorCapable ¶
func IsTerminalColorCapable() bool
IsTerminalColorCapable returns true if the current terminal environment supports color output, based on environment variables and terminal type heuristics.
Types ¶
type TerminalDisplay ¶
type TerminalDisplay struct {
// contains filtered or unexported fields
}
TerminalDisplay represents a terminal markdown displayer.
func NewTerminalDisplayWithMarkdownOptions ¶
func NewTerminalDisplayWithMarkdownOptions(mdOpts converter.Options) *TerminalDisplay
NewTerminalDisplayWithMarkdownOptions creates a TerminalDisplay with markdown options. This provides compatibility with the markdown package options.
func NewTerminalDisplayWithOptions ¶
func NewTerminalDisplayWithOptions(opts Options) *TerminalDisplay
NewTerminalDisplayWithOptions returns a TerminalDisplay configured with the provided options, setting the wrap width if not specified.
type Theme ¶
Theme represents a color theme with customizable palettes.
func CustomTheme ¶
func CustomTheme() Theme
CustomTheme returns a Theme with an empty palette and Glamour style set to "auto", intended for user customization.
func DarkTheme ¶
func DarkTheme() Theme
DarkTheme returns a Theme configured with a predefined dark color palette and the Glamour style "dark".
func DetectTheme ¶
DetectTheme determines the theme based on configuration and environment. DetectTheme determines the terminal color theme to use based on the provided configuration, the OPNDOSSIER_THEME environment variable, or automatic detection if neither is set.
func LightTheme ¶
func LightTheme() Theme
LightTheme returns a Theme configured with a predefined light color palette and the Glamour style "light".
func (*Theme) GetGlamourStyleName ¶
GetGlamourStyleName returns the Glamour style name for this theme.