This introduces a helper type LightDark that takes a boolean to determine which Color(light, dark) to choose from. The adaptive package is a helper package that uses the lipgloss.LightDark along with querying the terminal when the module is imported to choose the appropriate light-dark color.
This will also make lipgloss.Color take any type and try to infer the color from either strings or integers.
Example:
var (
light = "#0000ff"
dark = "#ff0000"
)
colorToUse := adaptive.Color(light, dark) // the terminal is queried before choosing the color
fmt.Println(colorToUse)
This introduces a helper type
LightDark
that takes a boolean to determine whichColor(light, dark)
to choose from. Theadaptive
package is a helper package that uses thelipgloss.LightDark
along with querying the terminal when the module is imported to choose the appropriate light-dark color.This will also make
lipgloss.Color
takeany
type and try to infer the color from either strings or integers.Example: