Documentation ¶
Overview ¶
Package compat is a compatibility layer for Lip Gloss that provides a way to deal with the hassle of setting up a writer. It's impure because it uses global variables, is not thread-safe, and only works with the default standard I/O streams.
In case you want os.Stderr to be used as the default writer, you can set both [Writer] and HasDarkBackground to use os.Stderr with the following code:
import ( "os" "github.com/charmbracelet/colorprofile" "github.com/charmbracelet/lipgloss/v2/impure" ) func init() { impure.Writer = colorprofile.NewWriter(os.Stderr, os.Environ()) impure.HasDarkBackground, _ = lipgloss.HasDarkBackground(os.Stdin, os.Stderr) }
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type AdaptiveColor ¶
AdaptiveColor provides color options for light and dark backgrounds. The appropriate color will be returned at runtime based on the darkness of the terminal background color.
Example usage:
color := lipgloss.AdaptiveColor{Light: "#0000ff", Dark: "#000099"}
type CompleteAdaptiveColor ¶
type CompleteAdaptiveColor struct { Light CompleteColor Dark CompleteColor }
CompleteAdaptiveColor specifies exact values for truecolor, ANSI256, and ANSI color profiles, with separate options for light and dark backgrounds. Automatic color degradation will not be performed.
type CompleteColor ¶
CompleteColor specifies exact values for truecolor, ANSI256, and ANSI color profiles. Automatic color degradation will not be performed.