zenbones-theme / zenbones.nvim

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

How can I make strings NOT be italic? #174

Closed nshern closed 1 month ago

nshern commented 1 month ago

I am using the Zenbones theme and I am trying to make it so that strings are not italic. Given this documentation

Should this .config/nvim/lua/zenbones.lua/ not work?

Nothing is happening currently.

return {
  'mcchrish/zenbones.nvim',
  -- Optionally install Lush. Allows for more configuration or extending the colorscheme
  -- If you don't want to install lush, make sure to set g:zenbones_compat = 1
  -- In Vim, compat mode is turned on as Lush only works in Neovim.
  dependencies = 'rktjmp/lush.nvim',
  config = function()
    local lush = require 'lush'
    local base = require 'zenbones'

    -- Create custom specifications
    local specs = lush.parse(function()
      return {
        -- Override the String highlight to remove italics
        String { base.String, gui = 'NONE' },
      }
    end)

    -- Apply the custom specifications
    lush.apply(lush.compile(specs))
    vim.cmd.colorscheme 'zenbones'
  end,
}
mcchrish commented 1 month ago

Can you try passing gui = ''?

Alternatively, it's easy to use the neovim API too https://github.com/mcchrish/zenbones.nvim/issues/135#issuecomment-1817608263

nshern commented 1 month ago

This is how I solved it:

return {
  'mcchrish/zenbones.nvim',
  dependencies = 'rktjmp/lush.nvim',
  config = function()
    vim.cmd.colorscheme 'zenbones'
    vim.cmd [[
      augroup MyColorSchemeTweaks
        autocmd!
        autocmd ColorScheme zenbones lua MyZenbonesTweaks()
      augroup END
    ]]

    function MyZenbonesTweaks()
      if vim.o.background == 'light' then
        vim.api.nvim_set_hl(0, 'Constant', { fg = '#556570' })
        vim.api.nvim_set_hl(0, 'Number', { fg = '#2c363c' })
      else
        vim.api.nvim_set_hl(0, 'Constant', { fg = '#868C91' })
        vim.api.nvim_set_hl(0, 'Number', { fg = '#B4BDC3' })
      end
    end

    -- Trigger the tweaks immediately in case the colorscheme is already set
    MyZenbonesTweaks()
  end,
}