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

can't set background color for terminal #29

Closed
cdepillabout opened this issue Sep 5, 2018 · 5 comments · Fixed by #111
Closed

can't set background color for terminal #29

cdepillabout opened this issue Sep 5, 2018 · 5 comments · Fixed by #111
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@cdepillabout
Copy link
Owner

@LSLeary implemented the ability to set the colors for the terminal in #28.

However, it looks like there is a problem with setting the background color of the terminal. He's not sure whether this is a problem in his own code, or gi-vte, or the VTE library itself.

@cdepillabout cdepillabout added bug Something isn't working help wanted Extra attention is needed labels Sep 5, 2018
@cdepillabout
Copy link
Owner Author

After doing a little investigation into this, we don't think that it is a problem with the Termonad code, or the gi-vte library (since it is a relatively thin wrapper), but instead with the VTE library.

It would be a good idea to testing this out with the latest version of the VTE library and seeing if it still doesn't work. This should be relatively easy using nix.

If it is still broken, then we should create an issue on the VTE repo reporting it and asking what to do here.

In the meantime, the documentation for Termonad.Config should be updated to show that the background can actually be set by passing Nothing for the background argument in order to use the very first element of the palette array as the background color.

@dakotaclemenceplaza
Copy link
Contributor

dakotaclemenceplaza commented Jun 24, 2019

Hi, it seems nobody is working on this as well as well as on #73. I've looked into this code

  terminalSetColors vteTerm Nothing Nothing . Just
    =<< traverse toRGBA (paletteToList . palette $ colourConf)
  -- PR #28 / issue #29: Setting the background colour is broken in gi-vte or VTE.  If
  -- this next line is called, then you are no longer able to set the
  -- background color using the palette.
  -- terminalSetColorBackground vteTerm =<< toRGBA (backgroundColour colourConf)
  terminalSetColorForeground vteTerm =<< toRGBA (foregroundColour colourConf)

The problem seems to be that even if you don't specify backgroundColor in your config it just sets the colour from default config which happens to be black. If you put terminalSetColorBackground before terminalSetColors then you can use palette because it will overwrite background color. Isn't it just the matter of order? terminalSetColorForeground works the same way. You have three different ways to specify color for background - default, specific and through the palette and the last one overwrites everything.

@cdepillabout
Copy link
Owner Author

@dakotaclemenceplaza Thanks a lot for looking into this.

How would you recommend fixing it? Just switching the order to terminalSetColors and terminalSetColorBackground/terminalSetColorForeground? Or maybe you're saying that you can either use terminalSetColors OR terminalSetColorBackground, but using both doesn't work?

Would you be able to send a PR fixing this? (And hopefully updating the datatype and documenation on ColourConfig as needed?)

@dakotaclemenceplaza
Copy link
Contributor

I'm not sure yet how exactly to make it better, at the very least the point is to use default config only if there are no others. I'll try to think about it more and then fix it.

@dakotaclemenceplaza
Copy link
Contributor

I sent the PR.
The bug was even more subtle. My first goal was to add transparency so I was adding some code that eventually helped me to catch it. In addition to the order, when you set background color you create newZeroRGBA which has alpha and defaults to 0 meaning that color becomes completely transparent and non-visible, but at the same time transparency wasn't working and it just resulted in a black background. At least I think it was that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
2 participants