-
Notifications
You must be signed in to change notification settings - Fork 799
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support terminal color profiles
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
- Loading branch information
1 parent
a26ecc5
commit 8b51296
Showing
6 changed files
with
72 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package tea | ||
|
||
import "github.com/charmbracelet/colorprofile" | ||
|
||
// ColorProfileMsg is a message that describes the terminal's color profile. | ||
// This message is send to the program's update function when the program is | ||
// started. | ||
// | ||
// To upgrade the terminal color profile, use the `tea.RequestCapability` | ||
// command to request the `RGB` and `Tc` terminfo capabilities. Bubble Tea will | ||
// then cache the terminal's color profile and send a `ColorProfileMsg` to the | ||
// program's update function. | ||
type ColorProfileMsg struct { | ||
colorprofile.Profile | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters