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

docs: add truecolor info #273

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

docs: add truecolor info #273

wants to merge 5 commits into from

Conversation

bashbunni
Copy link
Member

Not sure if this should live in the README or in a dedicated docs section...
Will figure that out before merging. A review on the content itself would be
appreciated!

@bashbunni bashbunni marked this pull request as draft May 9, 2024 13:57
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated
@@ -162,8 +162,6 @@ useradd --system --user-group --create-home myapp

That should do it.

###
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh HA, I can add this back in. I thought I had accidentally added this

terminal for support if `COLORTERM` is not detected.

> [!NOTE]
> Wish uses [termenv][termenv] under the hood, which will set truecolor for a few
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't even know if this sentence makes sense 😂 may need a lil tidy later

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the chain of deps is more like wish -> lipgloss -> termenv

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

going to leave this part out for now given we're going to intro term changes soon which might include different default behaviour

terminal for support if `COLORTERM` is not detected.

> [!NOTE]
> Wish uses [termenv][termenv] under the hood, which will set truecolor for a few
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
> Wish uses [termenv][termenv] under the hood, which will set truecolor for a few
> Wish uses [termenv][termenv] under the hood, which will set `truecolor` for a few


`CLICOLOR_FORCE` - overrides `CLICOLOR`.

NO_COLOR vs CLICOLOR: if NO_COLOR is set or CLICOLOR=0 then the output should
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
NO_COLOR vs CLICOLOR: if NO_COLOR is set or CLICOLOR=0 then the output should
`NO_COLOR` vs `CLICOLOR`: if `NO_COLOR `is set or `CLICOLOR=0` then the output should

@bashbunni bashbunni marked this pull request as ready for review May 14, 2024 01:15
@tartavull
Copy link

I know this might not be the ideal place to ask, but I’m lost and desperate for a solution.

We have a Wish application that displays colors perfectly when run locally. Setting environment variables like NO_COLOR or CLICOLOR=0 correctly disables the colors as expected. However, when I deploy this Wish application to the server, it doesn’t display any colors.

I’ve tried the following steps without success:

  1. Tested every available terminal.

  2. Set SendEnv COLORTERM in the SSH configuration.
    Given this, and the wish app running locally seems like a strong indicator that the problem is the server and not the client.

  3. Added bubbletea.MiddlewareWithColorProfile(teaHandler, termenv.TrueColor) to the application.

  4. Set CLICOLOR=1, and making sure NO_COLOR is not set in the container.

Despite these efforts, the application still doesn’t display colors when run on a server. Any advice on what else I could try to resolve this issue would be greatly appreciated.

This description is more concise and clearly states the problem and the steps you’ve already taken to try to resolve it.

@caarlos0
Copy link
Member

@tartavull I successfully made the bubbletea example (PS: need to serve it on 0.0.0.0 instead of localhost) work inside a container (with no colors, as you can see in the log), and clients got colors anyway:

CleanShot 2025-01-13 at 15 26 08@2x

CleanShot 2025-01-13 at 15 26 45@2x

The trick is to use a custom renderer for your lipgloss colors. By default, it'll use the one from the current environment, which in this case is the server, not the client.

So we need to make a new renderer using the client's info and use it instead. See

renderer := bubbletea.MakeRenderer(s)

Hope that helps.

We should probably document this, too.

All this should be improved in the v2 stack of everything.

@caarlos0
Copy link
Member

fwiw @bashbunni I pushed some updates

I think we should probably merge this

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.

3 participants