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

Set terminal background color #207

Open
ajeetdsouza opened this issue Jan 30, 2022 · 7 comments · May be fixed by #567
Open

Set terminal background color #207

ajeetdsouza opened this issue Jan 30, 2022 · 7 comments · May be fixed by #567
Labels
enhancement New feature or request triage

Comments

@ajeetdsouza
Copy link
Contributor

Hey, thanks for the fantastic set of libraries!

It would be great to have a way to set the background color for the entire terminal, which would be reset upon exit. This is useful for apps that use AltScreen.

@meowgorithm
Copy link
Member

Hi there! This is totally possible with Lip Gloss.

Here’s an example.

The gist of it is:

  1. Define a lipgloss.Style for your application with your background color
  2. Listen for tea.WindowSizeMsgs to get the terminal's dimensions
  3. Set the width and height on your application style in your View() as you render

Let us know if you have any more questions, and feel free to hop in our Slack, too.

Example output:

example

@ajeetdsouza
Copy link
Contributor Author

This is what I'm seeing (WSL2 / Ubuntu / Windows 11 / Windows Terminal Preview):

image

On the other hand, if I echo -ne "\033]11;rgb:53/18/6f\007", I get:

image

Notice how the first example doesn't get the borders exactly right, but the second one does.

@meowgorithm meowgorithm added the enhancement New feature or request label Jan 30, 2022
@meowgorithm
Copy link
Member

meowgorithm commented Jan 30, 2022

Aha, I see what you're saying now. We all think this is a great idea will totally implement it (in fact, @muesli is already implementing upstream). We'll keep this issue updated with progress.

Thanks for the feedback and clarification!

@ajeetdsouza
Copy link
Contributor Author

Looking forward to it. Thanks for the quick reply!

@muesli
Copy link
Member

muesli commented Jan 31, 2022

Merged in termenv!

@ajeetdsouza
Copy link
Contributor Author

Awesome! Shall I close this issue, or do you plan to expose that function directly via Bubbletea?

@meowgorithm
Copy link
Member

Let’s leave this open for now. We’ll integrate it into Bubble Tea in a manner in which it will automatically cleanup on shutdown.

@michal-kralik michal-kralik linked a pull request Oct 21, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request triage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants