zenbones-theme / zenbones.nvim

🪨 A collection of contrast-based Vim/Neovim colorschemes
MIT License
650 stars 46 forks source link

Disable italics on numbers and strings. #135

Closed dannyfritz closed 7 months ago

dannyfritz commented 9 months ago

I'm using LazyVim and I've been trying to get Lush working for a while now. Any tips for how to disable the italics for numbers and strings? Trying to follow this guide: https://github.com/mcchrish/zenbones.nvim/blob/v3.1.0/doc/zenbones.md#extendoverride-highlights

-- lua/plugins/colorscheme.lua
return {
  {
    "mcchrish/zenbones.nvim",
    dependencies = { "rktjmp/lush.nvim" },
    init = function()
      vim.g.neobones_darkness = "stark"
      vim.g.neobones_lighten_cursor_line = 8
      vim.g.neobones_lighten_comments = 40
      vim.g.neobones_italic_comments = false
      vim.api.nvim_create_autocmd({ "ColorScheme" }, {
        pattern = "neobones",
        callback = function()
          local lush = require("lush")
          local base = require("neobones")
          local testNum = 12344567890
          local specs = lush.parse(function()
            return {
              Constant = { base.Constant, gui = "NONE" },
              Number = { base.Number, gui = "NONE" },
            }
          end)
          lush.apply(lush.compile(specs))
        end,
      })
      vim.cmd("colorscheme neobones")
    end,
  },
  {
    "LazyVim/LazyVim",
    opts = {
      colorscheme = "neobones",
    },
  },
}

Screenshot from 2023-09-25 00-17-24

mcchrish commented 7 months ago

@dannyfritz I'm able to reproduce the issue and I think the issue is with lush. It works with using plain nvim_set_hl api.

vim.api.nvim_create_autocmd({ "ColorScheme" }, {
    pattern = "neobones",
    callback = function(params)
        require("mcchrish.statusline").setup(params.match)
        local base = require(params.match)
        vim.api.nvim_set_hl(0, "Constant", { fg = base.Constant.fg.hex })
        vim.api.nvim_set_hl(0, "Number", { fg = base.Number.fg.hex })
    end,
})

Which makes it simpler actually. Alternatively, you can also use nvim_get_hl and nvim_set_hl combo to modify highlights too.

dannyfritz commented 7 months ago

@mcchrish thank you. The snippet you provided everything I need.

gegoune commented 7 months ago

That seems to be working for me:

local specs = lush.parse(function()
  return {
    Constant { base.Constant, gui = '' }
  }
end)
lush.apply(lush.compile(specs))