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 color profile writer #1143

Closed
wants to merge 1 commit into from

Conversation

aymanbagabas
Copy link
Member

This writer parses ANSI sequences and degrades the colors based on the given/detect color profile.

To detect a profile from an io.Writer:

pw := NewProfileWriter(os.Stdout, os.Environ())

To use a custom color profile:

pw := ProfileWriter{os.Stdout, ANSI256}

@aymanbagabas aymanbagabas force-pushed the colorprofile-writer branch 2 times, most recently from bbbfcc7 to d4c058b Compare September 12, 2024 21:26
This writer parses ANSI sequences and degrades the colors based on the
given/detect color profile.

To detect a profile from an io.Writer:
```go
pw := NewProfileWriter(os.Stdout, os.Environ())
```

To use a custom color profile:
```go
pw := ProfileWriter{os.Stdout, ANSI256}
```
aymanbagabas added a commit that referenced this pull request Sep 16, 2024
This adds support for detecting the terminal's color profile. It adds a
new `ColorProfileMsg` message that get sent when the program starts. You
can force a specific color profile using the `WithColorProfile` option.

When a program requests the `RGB` or `Tc` terminfo capabilities, Bubble
Tea will read the response, if there is one, and upgrade the cached
color profile and send the new profile to the program again.

Supersedes: #1142
Supersedes: #1143
@aymanbagabas aymanbagabas deleted the colorprofile-writer branch September 16, 2024 21:37
aymanbagabas added a commit that referenced this pull request Oct 29, 2024
This adds support for detecting the terminal's color profile. It adds a
new `ColorProfileMsg` message that get sent when the program starts. You
can force a specific color profile using the `WithColorProfile` option.

When a program requests the `RGB` or `Tc` terminfo capabilities, Bubble
Tea will read the response, if there is one, and upgrade the cached
color profile and send the new profile to the program again.

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

Successfully merging this pull request may close these issues.

2 participants