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

bug: fallback to Kitty foreground/background colors when Normal highlight is undefined #181

Closed
mikesmithgh opened this issue Jan 30, 2024 · 1 comment · Fixed by #185
Closed
Labels
bug Something isn't working released

Comments

@mikesmithgh
Copy link
Owner

When no Normal highlight is defined, we should attempt to fallback to Kitty's foreground and background if they exist.

Currently, we are falling back to hardcoded #ffffff and #000000.

See fallback functions:

local function fg_or_fallback(hl_def)
  local fg = type(hl_def.fg) == 'number' and string.format('#%06x', hl_def.fg) or hl_def.fg
  return hl_def.fg and fg or (vim.o.background == 'dark' and '#ffffff' or '#000000')
end

local function bg_or_fallback(hl_def)
  local bg = type(hl_def.bg) == 'number' and string.format('#%06x', hl_def.bg) or hl_def.bg
  return hl_def.bg and bg or (vim.o.background == 'dark' and '#000000' or '#ffffff')
end

Steps to reproduce:

vim.api.nvim_set_hl(0, 'Normal', {})

See original issue #179

@mikesmithgh mikesmithgh added the bug Something isn't working label Jan 30, 2024
mikesmithgh pushed a commit that referenced this issue Feb 1, 2024
## [4.0.2](v4.0.1...v4.0.2) (2024-02-01)

### Bug Fixes

* fallback to kitty colors when Normal hl is undefined ([#185](#185)) ([0d2e76f](0d2e76f)), closes [#181](#181)
@mikesmithgh
Copy link
Owner Author

🎉 This issue has been resolved in version 4.0.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant