veltza / st-sx

st terminal with pretty good sixel support
MIT License
13 stars 1 forks source link

Dim colors #2

Open Goosegit11 opened 6 months ago

Goosegit11 commented 6 months ago

Could you please advise me which patch affects this? In my st-flexipatch the colors are bright and yours are dim.

Flameshot_2024 02 23_15-08-15

By the way, the colors in WezTerm are just as dim.

image

And what patch is causing the transparency, or what is it?

veltza commented 6 months ago

Could you please advise me which patch affects this? In my st-flexipatch the colors are bright and yours are dim.

There shouldn't be any patches that affect colors except Bold is not bright patch, so you should be able to change each color via config.def.h or .Xresources.

And what patch is causing the transparency, or what is it?

You can change the transparency here or here. Those default values are coming from Alpha Focus Highlight patch, but do you think it would be better to disable transparency by default?

Goosegit11 commented 6 months ago

Well I have Bold is not bright patch enabled too. Here is my st-flexipatch configuration:

patches.h ```c #define ALPHA_PATCH 0 #define ALPHA_FOCUS_HIGHLIGHT_PATCH 0 #define ALPHA_GRADIENT_PATCH 0 #define ANYSIZE_PATCH 0 #define ANYSIZE_SIMPLE_PATCH 0 #define BACKGROUND_IMAGE_PATCH 0 #define BACKGROUND_IMAGE_RELOAD_PATCH 0 #define BLINKING_CURSOR_PATCH 0 #define BOLD_IS_NOT_BRIGHT_PATCH 1 #define BOXDRAW_PATCH 1 #define CLIPBOARD_PATCH 1 #define COLUMNS_PATCH 1 #define COPYURL_PATCH 0 #define COPYURL_HIGHLIGHT_SELECTED_URLS_PATCH 0 #define CSI_22_23_PATCH 0 #define DEFAULT_CURSOR_PATCH 0 #define DELKEY_PATCH 1 #define DISABLE_BOLD_FONTS_PATCH 0 #define DISABLE_ITALIC_FONTS_PATCH 0 #define DISABLE_ROMAN_FONTS_PATCH 0 #define DYNAMIC_CURSOR_COLOR_PATCH 0 #define EXTERNALPIPE_PATCH 0 #define EXTERNALPIPEIN_PATCH 0 #define FIXKEYBOARDINPUT_PATCH 0 #define FONT2_PATCH 0 #define FULLSCREEN_PATCH 0 #define HIDECURSOR_PATCH 0 #define HIDE_TERMINAL_CURSOR_PATCH 0 #define INVERT_PATCH 0 #define ISO14755_PATCH 0 #define KEYBOARDSELECT_PATCH 0 #define LIGATURES_PATCH 0 #define MONOCHROME_PATCH 0 #define NETWMICON_PATCH 0 #define NEWTERM_PATCH 0 #define NO_WINDOW_DECORATIONS_PATCH 0 #define OPENCOPIED_PATCH 0 #define OPENURLONCLICK_PATCH 0 #define RELATIVEBORDER_PATCH 0 #define RIGHTCLICKTOPLUMB_PATCH 0 #define SCROLLBACK_PATCH 1 #define SCROLLBACK_MOUSE_PATCH 0 #define SCROLLBACK_MOUSE_ALTSCREEN_PATCH 1 #define SINGLE_DRAWABLE_BUFFER_PATCH 0 #define SIXEL_PATCH 1 #define ST_EMBEDDER_PATCH 0 #define SPOILER_PATCH 0 #define SWAPMOUSE_PATCH 0 #define SYNC_PATCH 0 #define THEMED_CURSOR_PATCH 0 #define UNDERCURL_PATCH 1 #define UNIVERSCROLL_PATCH 0 #define USE_XFTFONTMATCH_PATCH 0 #define VERTCENTER_PATCH 0 #define VIM_BROWSE_PATCH 0 #define VISUALBELL_1_PATCH 0 #define W3M_PATCH 0 #define WIDE_GLYPHS_PATCH 0 #define WIDE_GLYPH_SPACING_PATCH 0 #define WORKINGDIR_PATCH 0 #define XRESOURCES_PATCH 1 #define XRESOURCES_RELOAD_PATCH 0 ```

Also both st-sx and my st use the same .Xresources:

.Xresources ```c ! Base16 Gruvbox dark, medium ! Scheme: Dawid Kurek (dawikur@gmail.com), morhetz (https://github.com/morhetz/gruvbox) #define base00 #282828 #define base01 #3c3836 #define base02 #504945 #define base03 #665c54 #define base04 #bdae93 #define base05 #d5c4a1 #define base06 #ebdbb2 #define base07 #fbf1c7 #define base08 #fb4934 #define base09 #fe8019 #define base0A #fabd2f #define base0B #b8bb26 #define base0C #8ec07c #define base0D #83a598 #define base0E #d3869b #define base0F #d65d0e *foreground: base05 *background: base00 *cursorColor: base05 *color0: base00 *color1: base08 *color2: base0B *color3: base0A *color4: base0D *color5: base0E *color6: base0C *color7: base05 *color8: base03 *color9: base08 *color10: base0B *color11: base0A *color12: base0D *color13: base0E *color14: base0C *color15: base07 ! Note: colors beyond 15 might not be loaded (e.g., xterm, urxvt), ! use 'shell' template to set these if necessary *color16: base09 *color17: base0F *color18: base01 *color19: base02 *color20: base04 *color21: base06 ```

Also now I see that the only dim color is white. Other colors are the same.

veltza commented 6 months ago

I really can't reproduce your issue. I took your patches.h and .Xresources files and compiled st-flexipatch and didn't notice any difference between st-sx and st-flexipatch. The colors were exactly the same. I even put the colors in the config.h file and I still didn't notice any difference. So there must be something else in your configuration somewhere that affects this.

One thing you could do is try changing the color theme using themes.sh and see if the terminals look the same. If they do, we know we have a configuration issue. If they don't, then I really don't know what's causing the issue because st-sx is patched using st-flexipatch and I haven't changed anything that would affect the colors as far as I can remember.

Goosegit11 commented 6 months ago

I tried this theme.sh thingy, and yeah, colors are the same as in st-sx.

Then I remembered about the Gruvbox color scheme in config.def.h.

I thought Xresources patch completely overwrites the color scheme in config.def.h, but I'm not sure now. What do you think?

config.def.h ```c /* Terminal colors (16 first used in escape sequence) */ static const char *colorname[] = { /* 8 normal colors */ [0] = "#282828", /* hard contrast: #1d2021 / soft contrast: #32302f */ [1] = "#cc241d", /* red */ [2] = "#98971a", /* green */ [3] = "#d79921", /* yellow */ [4] = "#458588", /* blue */ [5] = "#b16286", /* magenta */ [6] = "#689d6a", /* cyan */ [7] = "#a89984", /* white */ /* 8 bright colors */ [8] = "#928374", /* black */ [9] = "#fb4934", /* red */ [10] = "#b8bb26", /* green */ [11] = "#fabd2f", /* yellow */ [12] = "#83a598", /* blue */ [13] = "#d3869b", /* magenta */ [14] = "#8ec07c", /* cyan */ [15] = "#ebdbb2", /* white */ }; ```
veltza commented 6 months ago

First of all, config.def.h is just a template file and you should never edit it, because st (or any suckless tool) doesn't use it. You should always edit config.h. It's not there first, so you have to copy config.def.h to config.h manually or just run make. And after that, edit the file, compile and install the app. I'm pretty sure you know that already, but I just wanted to make sure that we are on the same page.

As for the .Xresources file, all the settings you define there will overwrite the settings in your config.h file. So you should be able to completely or partially override the colors if you want to do so.

Are there other settings in your .Xresource file other than the ones above? Are some colors accidentally defined twice? You can run xrdb -query -all to check if there is anything odd in your Xresource settings.

One thing you could do is try setting the St class to the color names in your .Xresources file to see if that makes any difference. For example:

St.color0:          base00
St.color1:          base08
...

See the xresources-example file.

Btw, your config.def.h or config.h snippet doesn't look right because these are missing:

    [255] = 0,

    /* more colors can be added after 255 to use with DefaultXX */
    "#cccccc", /* 256 -> cursor */
    "#555555", /* 257 -> rev cursor */
    "gray90",  /* 258 -> foreground */
    "black",   /* 259 -> background */
    "black",   /* 260 -> background unfocused */
Goosegit11 commented 6 months ago

I use config.def.h because that's what patches always modify. I edit it with my changes, delete config.h, run sudo make clean install. I would be glad if you could tell me if I'm doing something wrong.

`xrdb -query -all` ```sh *foreground: #d5c4a1 *background: #282828 *cursorColor: #d5c4a1 *color0: #282828 *color1: #fb4934 *color2: #b8bb26 *color3: #fabd2f *color4: #83a598 *color5: #d3869b *color6: #8ec07c *color7: #d5c4a1 *color8: #665c54 *color9: #fb4934 *color10: #b8bb26 *color11: #fabd2f *color12: #83a598 *color13: #d3869b *color14: #8ec07c *color15: #fbf1c7 *color16: #fe8019 *color17: #d65d0e *color18: #3c3836 *color19: #504945 *color20: #bdae93 *color21: #ebdbb2 st.alpha: 1 st.termname: st-256color st.font: Iosevka Nerd Font Propo,Iosevka NFP:style=Regular:pixelsize=18 Xft.dpi: 115 Xft.antialias: 1 Xft.rgba: rgb Xft.hinting: 1 Xft.hintstyle: hintslight ```

By the way:

Cursor color changes when focusing on colored text ![Peek 2024-03-10 18-27](https://github.com/veltza/st-sx/assets/89806596/5764f413-44a1-446c-8006-f6c588026310)
Comments are not visible ![Peek 2024-03-10 18-31](https://github.com/veltza/st-sx/assets/89806596/a79fc6cd-1776-4f24-bdd0-ce7591dc3055)

UPD: I'm sorry, the GIFs came out a little laggy.

veltza commented 6 months ago

Believe me, I'd like to solve this issue too, but I can't reproduce it. Something is missing from the equation.

So, what kind of Zsh plugins are you using? Do you use them with default settings or do you use some customizations?

What happens when you run Bash on both terminals? Do they look the same? You could even try changing the login shell to Bash and then logging out and back in to see if that makes a difference.

I assume you already tried setting the settings in config.h only and not using Xresources at all, and that didn't solve anything?

Cursor color changes when focusing on colored text

It is the dynamic cursor color patch that behaves that way.

Goosegit11 commented 6 months ago
It's not a shell issue ![image](https://github.com/veltza/st-sx/assets/89806596/976e71b0-ff07-4dc2-b43e-0d8cd88dfceb)

I have removed color values from .Xresources

.Xresources-nocolor ```sh st.font: Iosevka Nerd Font Propo,Iosevka NFP:style=Regular:pixelsize=18 !!-- Xft settings -- ! Xft.dpi: 96 Xft.antialias: true Xft.rgba: rgb Xft.hinting: true Xft.hintstyle: hintfull ```

Yes, the colors have changed, in both terminals. Now st-sx has the same non-dull white color as my st. But there's something wrong with the FG/BG...

And some colors, such as blue and pink, now are a little different, but it doesn't matter, I'll change them later as necessary.


UPD: Firefox says that the video is corrupted so I can't play it in the browser, but downloading and playing it in mpv works. ¯\(ツ)\\/¯ Tell me if it's not working for you.

https://github.com/veltza/st-sx/assets/89806596/141ffc5b-d842-48af-bce8-e57b234e66f3

A couple of questions/comments besides these already in the video:

00:44 The fastfetch color blocks look different, on my st they have a weird line inbetween, on the st-sx they look smoother

00:47 The FG/BG values differ, my st has Gruvbox FG/BG when st-sx has some kind of "default" values, like pitch black for the background, idk.

01:30 The st-sx window resizes weirdly, I assume it's the ANYSIZE patch?

02:05 Scrollback works differently, I assume it's the SCROLLBACK_REFLOW patch?

veltza commented 6 months ago

Your video was really helpful because it helped me solve your issue!

First of all, be careful because the colorname table is not compatible with st-flexipatch. There are small differences at the end of the array:

st-sx

    /* more colors can be added after 255 to use with DefaultXX */
    "#cccccc", /* 256 -> cursor */
    "#555555", /* 257 -> rev cursor */
    "gray90",  /* 258 -> foreground */
    "black",   /* 259 -> background */
    "black",   /* 260 -> background unfocused */

st-flexipatch

    /* more colors can be added after 255 to use with DefaultXX */
    "#add8e6", /* 256 -> cursor */
    "#555555", /* 257 -> rev cursor*/
    "#000000", /* 258 -> bg */
    "#e5e5e5", /* 259 -> fg */

As you can see, foreground (fg) and background (bg) are reversed. It's because st-sx has two background colors.

But this was not the main issue. The real issue can be found at 1:49 of the video:

color-issues

I noticed that you had changed the indexes in the defaultbg, defaultfg and defaultcs variables, because the default values in st-flexipatch are these:

unsigned int defaultbg = 258;
#endif // ALPHA_FOCUS_HIGHLIGHT_PATCH
unsigned int defaultfg = 259;
unsigned int defaultcs = 256;
unsigned int defaultrcs = 257;

Since you set defaultbg to 0, st-flexipatch reads background color from color index 0 and foreground color (defaultfg) from index 15. But st-sx reads background color from color index 259 (or 260) and foreground color from index 258. So there's the issue!

Is there a particular reason why you want to change those indexes? Because if you change them, you should also change the indexes to the resources array, because otherwise Xresources will set the colors to the wrong color indexes. I recommend that you do not change any indexes as there should be no need to do so.

00:44 The fastfetch color blocks look different, on my st they have a weird line inbetween, on the st-sx they look smoother

I'm not sure, but you could try disabling ligatures and see if that changes anything.

01:30 The st-sx window resizes weirdly, I assume it's the ANYSIZE patch?

It is ANYSIZE_SIMPLE_PATCH and it is intended for window manager users. I can add a setting to disable it if you want.

02:05 Scrollback works differently, I assume it's the SCROLLBACK_REFLOW patch?

Yes, it is.

bakkeby commented 6 months ago

The alpha blend for st are brighter than for alacritty for example.

Reminds me of this post from a year ago:

That change would look like this in st-flexipatch:

diff --git a/x.c b/x.c
index 06ac5c4..cfa4411 100644
--- a/x.c
+++ b/x.c
@@ -1018,6 +1018,9 @@ xloadcols(void)
        dc.col[defaultbg].color.alpha = (unsigned short)(0xffff * alpha);
        dc.col[defaultbg].pixel &= 0x00FFFFFF;
        dc.col[defaultbg].pixel |= (unsigned char)(0xff * alpha) << 24;
+       dc.col[defaultbg].color.red   *= alpha;
+       dc.col[defaultbg].color.green *= alpha;
+       dc.col[defaultbg].color.blue  *= alpha;
        #endif // ALPHA_PATCH
        loaded = 1;
 }
@@ -1058,6 +1061,9 @@ xsetcolorname(int x, const char *name)
                dc.col[defaultbg].color.alpha = (unsigned short)(0xffff * alpha);
                dc.col[defaultbg].pixel &= 0x00FFFFFF;
                dc.col[defaultbg].pixel |= (unsigned char)(0xff * alpha) << 24;
+               dc.col[defaultbg].color.red   *= alpha;
+               dc.col[defaultbg].color.green *= alpha;
+               dc.col[defaultbg].color.blue  *= alpha;
        }
        #endif // ALPHA_PATCH
        return 0;

Personally I think it looks much better.

veltza commented 6 months ago

The alpha blend for st are brighter than for alacritty for example.

I'm surprised that the authors of the patch never noticed or bothered to fix this.

Although the alpha issue does not affect this open issue, it has now been fixed in st-sx.