kovidgoyal / kitty

Cross-platform, fast, feature-rich, GPU based terminal
https://sw.kovidgoyal.net/kitty/
GNU General Public License v3.0
24.41k stars 980 forks source link

Hints Kitten highlights bright are invisible in light themes #7330

Closed dderjoel closed 6 months ago

dderjoel commented 6 months ago

Describe the bug

When using the hints kitten, pressing CTRL+SHIFT+P>F, the files are highlighted. When using a light theme, the highlighted bright color is illegible. This does not happen with a dark theme

To Reproduce Steps to reproduce the behavior:

  1. Select a light theme such as "Solarized Light"
  2. ls in some directory
  3. press CTRL+SHIFT+P>F
  4. see that matching files are hinted bright and one cannot read it.
  5. repeat the process with a dark theme and the highlights are readable.

Screenshots dark light

Environment details

kitty 0.33.1 created by Kovid Goyal
Linux arch4 6.8.2-arch2-1 #1 SMP PREEMPT_DYNAMIC Thu, 28 Mar 2024 17:06:35 +0000 x86_64
Arch Linux 6.8.2-arch2-1 (/dev/tty)

Running under: X11
Frozen: False
Paths:
  kitty: /usr/bin/kitty
  base dir: /usr/lib/kitty
  extensions dir: /usr/lib/kitty/kitty
  system shell: /bin/zsh
Loaded config files:
  /home/joel/.config/kitty/kitty.conf

Config options different from defaults:
enable_audio_bell       False
input_delay             5
repaint_delay           20
shell_integration       frozenset({'no-complete'})
Added shortcuts:
    ctrl+- →  change_font_size all -2.0
    ctrl+= →  change_font_size all +2.0
Changed shortcuts:
    kitty_mod+p > f →  kitten hints --type path, kitten hints --type hyperlink, kitten hints --type linenum, kitten hints --type hash --program -, kitten hints --type word --program -, kitten hints --type line --program -, kitten hints --type path --program -
Colors:
    active_border_color     #cb4b16   
    active_tab_background   #fdf6e3   
    active_tab_foreground   #657b83   
    background              #fdf6e3   
    color0                  #073642   
    color1                  #dc322f   
    color10                 #586e75   
    color11                 #657b83   
    color12                 #839496   
    color13                 #6c71c4   
    color14                 #93a1a1   
    color15                 #fdf6e3   
    color2                  #859900   
    color3                  #b58900   
    color4                  #268bd2   
    color5                  #d33682   
    color6                  #2aa198   
    color7                  #eee8d5   
    color8                  #93a1a1   
    color9                  #cb4b16   
    cursor                  #657b83   
    cursor_text_color       #fdf6e3   
    foreground              #657b83   
    inactive_border_color   #93a1a1   
    inactive_tab_background #93a1a1   
    inactive_tab_foreground #fdf6e3   
    selection_background    #eee8d5   
    selection_foreground    #586e75   

Important environment variables seen by the kitty process:
    PATH                                /home/joel/bin:/usr/local/bin:/home/joel/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/home/joel/.local/share/gem/ruby/3.0.0/bin
    LANG                                en_US.UTF-8
    EDITOR                              nvim
    SHELL                               /bin/zsh
    DISPLAY                             :0
    USER                                joel
    XDG_CONFIG_HOME                     /home/joel/.config
    XDG_SEAT                            seat0
    XDG_SESSION_TYPE                    tty
    XDG_SESSION_CLASS                   user
    XDG_VTNR                            1
    XDG_SESSION_ID                      1
    XDG_RUNTIME_DIR                     /run/user/1000

Additional context Cannot be reproduced with a blank config, because a light theme must be selected

kovidgoyal commented 6 months ago

This is a bug in the theme you are using. The highlight kitten does not use any actual colors, instead it makes use of only the first 16 indexed colors whose actual values are set by the theme. The theme is violating contrast requirements between those colors.

Use for instance Gruvbox Light or Kaolin Breeze and you will be fine.

kovidgoyal commented 6 months ago

Oh and in case you dont want to change the theme you can also use --hints-text-color when invoking the kitten to override the color.

dderjoel commented 6 months ago

Yes thanks for coming back this quick. I thought it could be a themes bug, but I tried a couple themes and all of them showed the same issue. Thanks! I'll use the two that work then :)

Should I open another issue for the fact that it parses the paths wrong when a file has spaces (V46 - Repaired - Repaired)?

kovidgoyal commented 6 months ago

Spaces are not considered part of file paths, if they were it would become impossible to, for instance, get filenames from the output of ls. You can ofc ourse customize this however you like, see the docs of the kitten.

dderjoel commented 6 months ago

yeah I know I could use regex, but ls already prints the filename in 's, so I assumed that --type=path recognises that.

kovidgoyal commented 6 months ago

No, there are many tools apart from ls that prints paths separated from normal text by spaces. Path detection has to be more general. If you are particularly using it with ls use hyperlink mode, that is fully robust.

dderjoel commented 6 months ago

I'm not sure if we're talking about the same thing. I am using ls --hyperlink=auto --color=auto and then ls will list the files. If a filename has spaces in it, it surrounds the name with quotation marks '. I can now use my mouse to click it and icat-open it, but I fail do see how I could select it with my keyboard only.

kovidgoyal commented 6 months ago

Press ctrl+shift+p>y

dderjoel commented 6 months ago

yes, that lets me select correctly, but I want to insert the item on the cmd line. When I use kitten hints --type hyperlink --program - I end up with the link (e.g. file://arch4/home/joel/Videos/V45%20-%20Repaired.mp4) on my cmd line. I couldn't find a way to select the hyperlink but then only print the name in the documentation of the hints kitten?

kovidgoyal commented 6 months ago

The actions and selection of the hints kitten are completely customizable you can even write your own code to do whatever you want with them, see the kitten docs.