Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(v2) Adaptive standalone #394

Closed
wants to merge 22 commits into from
Closed

Conversation

meowgorithm
Copy link
Member

@meowgorithm meowgorithm commented Oct 11, 2024

This PR reworks the adaptive color workflow to be more explicit in standalone mode (in the spirit of the new Lip Gloss writer). It includes @bashbunni's suggestion to rename LightDark to Adapt.

// Detect the background color, explicitly choosing inputs and outputs.
hasDarkBG, err := lipgloss.HasDarkBackground(os.Stdin, os.Stdout);
if err != nil {
    fmt.Fprintf(os.Stderr, "Dang: %v", err)
    os.Exit(1)
}

// Use lil' adaptive colors.
adaptive := lipgloss.Adapt(hasDarkBG)
myHotColor := adaptive.Color("#ff0000", "#0000ff")

Supersedes #392.

@aymanbagabas aymanbagabas changed the title V2 adaptive standalone (v2) Adaptive standalone Oct 15, 2024
@bashbunni bashbunni added the v2 label Oct 15, 2024
@meowgorithm meowgorithm force-pushed the v2-adaptive-standalone branch from 762e3ca to 6fa7bb6 Compare October 17, 2024 17:10
@meowgorithm
Copy link
Member Author

This is my fault, but this is a PR for the same branch as #397. Closing accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants