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) feat: add compat package #419

Open
wants to merge 6 commits into
base: v2-exp
Choose a base branch
from
Open

(v2) feat: add compat package #419

wants to merge 6 commits into from

Conversation

aymanbagabas
Copy link
Member

@aymanbagabas aymanbagabas commented Oct 31, 2024

This adds a compatibility layer for Lip Gloss that provides a way to continue using AdaptiveColor and CompleteColor. It's impure because it uses global variables, is not thread-safe, and only works with the default standard I/O streams.

Users are encouraged to use the pure API when possible.

Here's an example to use a different output as the default:

import (
	"os"

	"github.com/charmbracelet/colorprofile"
	"github.com/charmbracelet/lipgloss/v2/compat"
)

func init() {
	compat.Profile = colorprofile.Detect(os.Stderr, os.Environ())
	compat.HasDarkBackground, _ = lipgloss.HasDarkBackground(os.Stdin, os.Stderr)
}

@aymanbagabas aymanbagabas added the v2 label Nov 1, 2024
@aymanbagabas aymanbagabas added this to the v2.0.0 milestone Nov 1, 2024
This adds a compatibility layer for Lip Gloss that provides a way to
continue using `AdaptiveColor` and `CompleteColor`. It's impure because
it uses global variables, is not thread-safe, and only works with the
default standard I/O streams.

Users are encouraged to use the pure API when possible.
@aymanbagabas aymanbagabas changed the title (v2) feat: add impure package (v2) feat: add combat package Nov 4, 2024
@aymanbagabas aymanbagabas changed the title (v2) feat: add combat package (v2) feat: add compat package Nov 4, 2024
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.

2 participants