Documentation
¶
Overview ¶
Package termcaps detects terminal capabilities (image protocol, true color, OSC 8 hyperlinks) and provides the pure hyperlink escape helper. It is a leaf so non-presentation layers (tool renderers) can ask "does this terminal support hyperlinks?" without linking the TUI; the tui package re-exports this surface unchanged.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Hyperlink ¶
Hyperlink wraps text in an OSC 8 hyperlink escape sequence. In terminals without hyperlink support the escape codes are ignored and only the plain text is displayed.
func ProbeTmuxHyperlinks ¶
func ProbeTmuxHyperlinks() bool
ProbeTmuxHyperlinks asks the ambient tmux client whether it forwards OSC 8.
func ResetCache ¶
func ResetCache()
ResetCache clears the pinned or detected value so the next Get re-detects.
func Set ¶
func Set(capabilities TerminalCapabilities)
Set pins the capabilities (tests and explicit configuration).
Types ¶
type ImageProtocol ¶
type ImageProtocol string
const ( ImageProtocolKitty ImageProtocol = "kitty" ImageProtocolITerm2 ImageProtocol = "iterm2" )
type TerminalCapabilities ¶
type TerminalCapabilities struct {
Images ImageProtocol
TrueColor bool
Hyperlinks bool
}
func Detect ¶
func Detect(tmuxForwardsHyperlink func() bool) TerminalCapabilities
Detect derives capabilities from the terminal environment. Behavior is a faithful port of upstream terminal-image.ts detection order.
func Get ¶
func Get() TerminalCapabilities
Get returns the cached capabilities, detecting them once on first use.