neanias / everforest-nvim

A Lua port of the Everforest colour scheme
233 stars 15 forks source link

How do I darken the bg of the CursorLine? #7

Closed agingorange closed 1 year ago

agingorange commented 1 year ago

I tried several variations of this:

require("everforest").setup({
  on_highlights = function (hl, palette)
    hl.CursorLine = { fg = palette.none, bg = palette.bg0, sp = palette.red }
  end
})

What's the correct way of doing this?

neanias commented 1 year ago

Hi there! This is the correct way of doing it, but you may not be seeing much because the colours aren't changing a lot with this example. palette.bg0 is the standard background colour for the theme and sp controls the colour of special characters (e.g. underlines). If you want to change the colour of the cursor line, changing the background to a different colour will make it more apparent:

require("everforest").setup({
  on_highlights = function (hl, palette)
    hl.CursorLine = { fg = palette.none, bg = palette.bg2 }
  end
})

Alternatively, you can keep the sp colour and add a separate style like underlines:

require("everforest").setup({
  on_highlights = function (hl, palette)
    hl.CursorLine = { fg = palette.none, bg = palette.bg0, sp = palette.red, underline = true }
  end
})
agingorange commented 1 year ago

Thanks for coming back to me!

I must've done something else wrong. This is all the code for the Lazy plugin manager. I've tried backgrounds and colors without success. What am I missing?

 {
    "neanias/everforest-nvim",
    version = false,
    lazy = false,
    priority = 1000,
    config = function()
      require("everforest").setup({
        on_highlights = function(hl, palette)
          hl.CursorLine = { fg = palette.none, bg = palette.yellow }
        end
      })
      require("everforest").load()
    end,
  },
neanias commented 1 year ago

I tested this locally and can't reproduce your problem, but could you try this snippet instead?

 {
    "neanias/everforest-nvim",
    version = false,
    lazy = false,
    priority = 1000,
    config = function()
      local everforest = require("everforest")
      everforest.setup({
        on_highlights = function(hl, palette)
          hl.CursorLine = { fg = palette.none, bg = palette.yellow }
        end
      })
      everforest.load()
    end,
  },
agingorange commented 1 year ago

Man, I'm so sorry. When I switched to Lazy, I forgot to enable the cursorline. :(

For completeness' sake, here's the code:

  {
    "neanias/everforest-nvim",
    version = false,
    lazy = false,
    priority = 1000,
    config = function()
      require("everforest").setup({
        on_highlights = function(hl, palette)
          hl.CursorLine = { fg = palette.none, bg = palette.bg1 }
        end
      })
    end,
    init = function()
      vim.opt.cursorline = true
      vim.o.background = "dark"
      vim.cmd.colorscheme("everforest")
    end,
  },

Again, I do apologize.

neanias commented 1 year ago

Haha, no problem! Before this, I wasn't as clear on how sp styling actually worked, so this has been a learning opportunity for me too. Glad it's fixed now!

neanias commented 1 year ago

Oh, a quick note: the CursorLine highlight is { fg = palette.none, bg = palette.bg1 }, so you can leave your custom highlight out and use the default one if you prefer

agingorange commented 1 year ago

So basically, what you're saying is, I sent us on a journey without a destination. Thanks! 🤣

neanias commented 1 year ago

I learnt something about highlights so I'm happy with that 😅