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) fix(examples): make examples use v2 #389

Closed
wants to merge 18 commits into from
Closed

Conversation

bashbunni
Copy link
Member

Goal: get the examples working for v2

  • ssh - tested with ANSI256 & truecolor and it's giving the right output
  • table examples
  • tree
  • layout
  • list

Only thing outstanding is clarifying how to work with light and dark backgrounds + detecting background color with v2. On that note, #359 is related to this PR

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.

Example:

```go
var (
  light = "#0000ff"
  dark = "#ff0000"
)

colorToUse := adaptive.Color(light, dark) // the terminal is queried before choosing the color
fmt.Println(colorToUse)
```
@bashbunni bashbunni added this to the v2.0.0 milestone Oct 10, 2024
@bashbunni
Copy link
Member Author

I also had to update log @ v2-exp to use colorprofile's Writer. Let me know the best way to navigate the un-merged deps. In this case I just have a go mod replace directive to point it to a local version of log checked out at v2-exp :)

@aymanbagabas aymanbagabas changed the title fix(examples): make examples use v2 (v2) fix(examples): make examples use v2 Oct 15, 2024
@meowgorithm
Copy link
Member

Rebased on v2-adaptive-standalone.

@meowgorithm
Copy link
Member

meowgorithm commented Oct 16, 2024

@bashbunni so the work here has been merged into #397, which contains solutions we're working though for adaptive colors, printers, and additional fixes for the open items here that were (excellently) documented.

In other words, for all intended and purposes, it’s the leading v2 branch right ow. Are you cool if I open a PR for that branch and supersede this one?

@bashbunni
Copy link
Member Author

@meowgorithm yeah totally cool! If we don't need this branch anymore we can close it

@bashbunni bashbunni closed this Oct 17, 2024
@meowgorithm meowgorithm deleted the v2-examples branch October 17, 2024 16:01
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