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

Custom color scheme not recognised unless defined inside config table in wezterm.lua #6421

Closed
prateektade opened this issue Nov 20, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@prateektade
Copy link

What Operating System(s) are you seeing this problem on?

Windows

Which Wayland compositor or X11 Window manager(s) are you using?

I am using Gentoo on WSL inside WezTerm

WezTerm version

20241119-101432-4050072d

Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?

Yes, and I updated the version box above to show the version of the nightly that I tried

Describe the bug

I wanted to define tab bar colors for the pre-installed Rosé Pine colorscheme (set using `config.color_scheme = 'rose-pine').

I started with the wezterm.color.get_builtin_schemes() function, following the example on this page. The colors got disturbed completely.

Then I removed those lines of code, created a separate TOML file with all the colors including the added tab bar colors, defined the path using config.color_scheme_dirs and then set the name inside the TOML file as the value for config.color_scheme. That disturbed the colors again, same as earlier.

To Reproduce

No response

Configuration

local wezterm = require 'wezterm'

local config = {}

if wezterm.config_builder then
  config = wezterm.config_builder()
end

local rose_pine_main = wezterm.color.get_builtin_schemes()['rose-pine']

rose_pine_main = {
  tab_bar = {
    background = 'hsl: 249 22 12',
    inactive_tab_edge = 'hsl: 249 12 47',
    active_tab = {
      bg_color = 'hsl: 248 25 18',
      fg_color = 'hsl: 245 50 91',
    },
    inactive_tab = {
      bg_color = 'hsl: 249 22 12',
      fg_color = 'hsl: 249 12 47',
    },
    inactive_tab_hover = {
      bg_color = 'hsl: 248 25 18',
      fg_color = 'hsl: 245 50 91',
    },
    new_tab = {
      bg_color = 'hsl: 249 22 12',
      fg_color = 'hsl: 249 12 47',
    },
    new_tab_hover = {
      bg_color = 'hsl: 248 25 18',
      fg_color = 'hsl: 245 50 91',
    },
  },
}

return {
  color_scheme_dirs = '/home/prateektade' -- created the rose-pine-main.toml file here
  color_schemes = {
    ['rose-pine'] = rose_pine_main,
  },
  color_scheme = 'rose-pine',
  --tried to set the colorscheme defined in the rose-pine-main.toml as follows
  --color_scheme = 'rose-pine-main',
}

Expected Behavior

No response

Logs

No response

Anything else?

No response

@prateektade prateektade added the bug Something isn't working label Nov 20, 2024
@bew
Copy link
Member

bew commented Nov 21, 2024

Hmm when you do:

rose_pine_main = {
  tab_bar = {
    ....
  }
}

You basically reset the rose_pine_main variable that you got from the first line, to ONLY have what you specified here.

If you only want to overwrite the tab bar settings you'd need to write it like this:

rose_pine_main.tab_bar = {
  ....
}

This will reset the rose_pine_main.tab_bar but leave all the other colors from the colorscheme config intact.

@prateektade
Copy link
Author

@bew Makes sense! Tried this and it works! Thank you.

What might be the issue with the colors from the toml config file not getting applied? The name doesn't clash with an existing color scheme name. I specified all the colors too.

@bew
Copy link
Member

bew commented Nov 21, 2024

What might be the issue with the colors from the toml config file not getting applied? The name doesn't clash with an existing color scheme name. I specified all the colors too.

Did you check the logs output from wezterm? (when run from another terminal) There might be useful information to help you debug this

@prateektade
Copy link
Author

Yes, I got an error saying that read Your configuration specifies color_scheme="rose-pine-toml" but that scheme was not found. It only recognised the file when I placed it in the %HOME%/.config/wezterm/colors directory. The color_scheme_dirs config option doesn't work I guess.

@bew
Copy link
Member

bew commented Nov 22, 2024

Ah according to the docs it should be a list (not sure why it didn't tell you the type was incorrect)

Try setting it with:

config.color_scheme_dirs = { '/home/prateektade' }
config.color_scheme = 'rose-pine-toml'
-- ...
return config

Copy link
Contributor

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants