dotfiles icon indicating copy to clipboard operation
dotfiles copied to clipboard

[FEATURE] For kitty terminal custom personal colors

Open mrjxtr opened this issue 1 year ago • 12 comments

I am loving the way that the terminal and border colors and the overall theme just changes whenever i select a new wallpaper.

I currently have a new wallpaper that I want to use and the issue is, the colors for that wallpaper not great for the terminal (i.e it is so hard to see what I am typing)

I there a way that I can bypass the automatic color matching even just for the kitty terminal? I found in the kitty.conf that it uses the include $HOME/.cache/wal/colors-kitty.conf for the colors but editing this file does nothing.

I also tried to create a custom.conf and added colors there but it also does nothing.

# Example Custom Colors that I want

foreground   #dedfe0
background   #0A0C0F
cursor       #dedfe0

color0       #0A0C0F
color8       #9b9c9c
color1       #707987
color9       #707987
color2       #7B8698
color10      #7B8698
color3       #8A95A8
color11      #8A95A8
color4       #9FA3AA
color12      #9FA3AA
color5       #B5BAC3
color13      #B5BAC3
color6       #BDC2C9
color14      #BDC2C9
color7       #dedfe0
color15      #dedfe0

This is what it looks like

Image

This is the colors that kitty automatically applies when using the wallpaper that I want (NOTICE the "testing" input i typed, it is so hard to see)

Image

mrjxtr avatar Jan 21 '25 13:01 mrjxtr

@mrjxtr You could try the following.

  1. Change your wallpaper that generates a kitty color scheme that you like.
  2. Copy the file $HOME/.cache/wal/colors-kitty.conf to a folder outside of .cache/wal/
  3. Change to the wallpaper that you like.
  4. Copy the file from your folder (outside of .cache/wal) back to $HOME/.cache/wal/colors-kitty.conf and overwrite the existing file.

I can try to expand the wallpaper script to us a temporary color-kitty.conf if exists in the .config/ml4w/settings folder. Maybe something for 2.9.8

mylinuxforwork avatar Jan 22 '25 12:01 mylinuxforwork

I tried this but it does not work. 🥲

After copying the file back into the $HOME/.cache/wal/ folder, the colors did not change. Even after restarting the terminal.

Also $HOME/.cache/wal/colors-kitty.conf automatically changes back to the colors for the current wallpaper (overwriting the custom colors that I want/copied).

Adding an option to custom define colors would be amazing for a future update! or even just change some of the colors or even just support to creating custom colors config file. 🙏🏼

mrjxtr avatar Jan 22 '25 12:01 mrjxtr

Until he fixes there are are a couple of hacks you can try. 1.) Set a wallpaper that gives you the colors you want for your terminal. Then set the colors-kitty.conf to Read Only. 2.) My workaround is I created a custom startup in the .config/zshrc directory. It runs a wal -i IMAGENAME on an image that gives me the colors I want. it's not a great "fix" as the color changes when you open a terminal. But for me it works and makes it easy to change the color any time. wo changing background

dwilliam62 avatar Feb 02 '25 01:02 dwilliam62

Thanks @dwilliam62, I will test out some of these workarounds but I do hope we will get this feature.

mrjxtr avatar Feb 03 '25 02:02 mrjxtr

It seems like wal is interpreting the wallpaper photo colour incorrectly. My workaround to this was to invert the colour of the wallpaper I'd like to use and save it into another file. Then I modified zshrc to run wal -i to interpret the inverted wallpaper instead. The result was perfect. Not elegant, but worked!

nayot-k avatar Feb 07 '25 19:02 nayot-k

@dwilliam62 @nayot-k what specific commands to I need to add on my zshrc to do this? My plan is to create a wallpaper of the colors I like, save it somewhere then just use the wall -i command to reference that for the terminal colors.

But I am not sure how to do the zshrc part

mrjxtr avatar Feb 08 '25 03:02 mrjxtr

@mrjxtr I created a script in ~/dotfiles/.config/zshrc (such as 22-tmp_correct_colour) with just a line as follow:

wal -i <path_to_your_inverted_wallpapaper> > /dev/null

The file will get source every time you open the terminal and correct the colour for you.

nayot-k avatar Feb 09 '25 00:02 nayot-k

@mrjxtr I created a script in ~/dotfiles/.config/zshrc (such as 22-tmp_correct_colour) with just a line as follow:

wal -i <path_to_your_inverted_wallpapaper> > /dev/null

The file will get source every time you open the terminal and correct the colour for you.

Thanks I'll try this later and will let you know how it goes... But I know this would work.

mrjxtr avatar Feb 09 '25 02:02 mrjxtr

@mrjxtr I created a script in ~/dotfiles/.config/zshrc (such as 22-tmp_correct_colour) with just a line as follow:

wal -i <path_to_your_inverted_wallpapaper> > /dev/null

The file will get source every time you open the terminal and correct the colour for you.

I did exactly this and it worked, however, there is a 3-second loading time that it does where, it load the terminal, applies the colours, then applies other configs like border size, padding, etc. and I can't open multiple terminals in quick succession because of this.

2 seconds of this

Image

then adjust to this after

Image

is this the expected behaviour every time I open a terminal in this configuration?

mrjxtr avatar Feb 12 '25 22:02 mrjxtr

If you are running wal every time yes as it has to analyze the file each time. If you create the pallete file once and have kitty read from that file it will be faster.

dwilliam62 avatar Feb 13 '25 00:02 dwilliam62

@mrjxtr In my opinion, it's not normal. Mine took < 1 sec to open a new instance of Kitty every time. My machine is an early 2015 Macbook Pro with 16 GB RAM.

If this is the case, however, we might need to put the script somewhere else and have it executed only once. We might want to put it some where in a Hyprland config file with 'exec-once' for example. This is, though, the config file should be run at the very end of the initialization process. I will try it and let your know.

Just an idea, you may want to try running wal -i ... directly from a terminal and see how long it takes to perform the task.

nayot-k avatar Feb 14 '25 01:02 nayot-k

[UPDATE]

This is a manual workaround. So an automated way to configure colors separate from what wal gives us would be much appreciated still.

but here is what I did

  • Comment out this line ~/.cache/wal/sequences in the zsh config. (Do this after you already loaded your desired wallpaper so all other colours apply using the wallpaper's colour palette)
  • Comment out this line include $HOME/.cache/wal/colors-kitty.conf in the kitty.conf file. (prevents kitty from loading the automated colour scheme generated by wal)
  • Created a custom.conf in the same directory as the kitty.conf and added your colour scheme.

You can copy the colour scheme from colors-kitty.conf and if you want to reverse it, just edit the HEX colours. or ask an LLM to do it... 🤓

You can also copy a colour scheme from others as long as it follows this

foreground   #FFFFFF
background   #FFFFFF
cursor       #FFFFFF

color0       #FFFFFF
color8       #FFFFFF

color1       #FFFFFF
color9       #FFFFFF

color2       #FFFFFF
color10      #FFFFFF

color3       #FFFFFF
color11      #FFFFFF

color4       #FFFFFF
color12      #FFFFFF

color5       #FFFFFF
color13      #FFFFFF

color6       #FFFFFF
color14      #FFFFFF

color7       #FFFFFF
color15      #FFFFFF
  • Foreground: Default text color.
  • Background: Terminal background color.
  • Cursor: The colour of the text cursor.

Standard Colors (0–7)

  • color0 (Default Black) – Default black (used for dark backgrounds)
  • color1 (Default Red) – Error messages, warnings
  • color2 (Default Green) – Success messages, directories (in some themes)
  • color3 (Default Yellow) – Prompts, symbolic links
  • color4 (Default Blue) – Directories (default in ls command)
  • color5 (Default Magenta) – Special file types, keywords in syntax highlighting
  • color6 (Default Cyan) – Network-related output, symbolic links (in some themes)
  • color7 (Default White/Light Gray) – Default light text color

Bright Colors (8–15)

  • color8 (Default Bright Black/Gray) – Dimmed black, used for secondary text
  • color9 (Default Bright Red) – More intense red for critical errors
  • color10 (Default Bright Green) – More intense green for highlighted success
  • color11 (Default Bright Yellow) – More intense yellow for warnings
  • color12 (Default Bright Blue) – More vibrant blue for directories or UI elements
  • color13 (Default Bright Magenta) – More vibrant magenta for syntax highlighting
  • color14 (Default Bright Cyan) – More vibrant cyan for additional network-related text
  • color15 (Default Bright White) – Brightest text color, often used for emphasis

These colors can vary depending on the terminal emulator and the applied theme.

mrjxtr avatar Mar 04 '25 14:03 mrjxtr