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

Setting custom_highlights #44

Open
timrosu opened this issue Jul 15, 2024 · 2 comments
Open

Setting custom_highlights #44

timrosu opened this issue Jul 15, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@timrosu
Copy link

timrosu commented Jul 15, 2024

Neovim version

NVIM v0.10.0
Build type: Release
LuaJIT 2.1.1716656478

Minimal configuration

{
"tiagovla/tokyodark.nvim",
lazy = false,
opts = {
transparent_background = true, -- set background to transparent
gamma = 0.9, -- adjust the brightness of the theme
custom_highlights = {} or function(highlights, palette) return { CursorLine = { bg = p.bg0 } } end, -- extend highlights
terminal_colors = true, -- enable terminal colors
},
config = function(_, opts)
require("tokyodark").setup(opts) -- calling setup is optional
vim.cmd.colorscheme "tokyodark"
end,
}

Description

I tried making CursorLine darker to make it more visible on transparent background, but it doesn't seem to work. Am I doing something wrong?

image

@timrosu timrosu added the bug Something isn't working label Jul 15, 2024
@timrosu
Copy link
Author

timrosu commented Jul 21, 2024

I saw in one issue that I can set color manually:

custom_highlights = {
  CursorLine = { bg = "#212234" },
  Visual = { bg = "#212234", },
} or function(highlights, palette)

But I still don't understand what is purpose of function(highlights, palette).

@tiagovla
Copy link
Owner

Sorry, I was a bit busy these last few weeks.

You can either pass a table of highlights or a function that returns a table of highlights.

If you want to modify the highlight's table (highlights.lua) or use the palette definitions (palette.lua), you can use them inside the function. Few examples:

custom_highlights = {
    Normal = { link = "Blue" }, --will be merged
}
custom_highlights = function(hl, p)
    return {
        Normal = { bg = p.blue }, --will be merged
    }
end,
custom_highlights = function(hl, p)
    hl["Normal"] = { bg = p.blue }, --modify in place
    return {}
end,

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

No branches or pull requests

2 participants