sho-87 / kanagawa-paper.nvim

Remixed Kanagawa colourscheme with muted colors. For Neovim.
MIT License
79 stars 2 forks source link

Hard to read lualine inactive tabs #3

Closed plague-doctor closed 2 months ago

plague-doctor commented 2 months ago

I'm attempting to understand the hues of your palette and subtly manipulate them to better suit my needs. Yet, I've encountered another issue I'm unable to resolve. The colour scheme in lualine makes the inactive tabs hard to read. Could you guide me on how to adjust this?

image

sho-87 commented 2 months ago

pushed out an update to increase the contrast a bit on those.

but to answer your question:

lualine is a bit of a special case because the colours for those are defined by a lualine theme. found here: https://github.com/sho-87/kanagawa-paper.nvim/blob/master/lua/lualine/themes/kanagawa-paper.lua

the inactive highlights are controlled by this block. a, b, and c are your regular lualine a,b,c sections:

kanagawa_paper.inactive = {
    a = { bg = theme.ui.bg_m3, fg = theme.ui.fg_gray },
    b = { bg = theme.ui.bg_m3, fg = theme.ui.fg_gray, gui = "bold" },
    c = { bg = theme.ui.bg_m3, fg = theme.ui.fg_gray },
}

so if you want to override those colours, you can create a custom theme based on the included theme, but assign different highlight groups to the sections you want. this is just the same as customizing a theme as per the lualine docs. For example, this will change the bg and fg of your a sections for inactive elements:

local M = {
  "nvim-lualine/lualine.nvim",
  opts = function()
    local kanagawa_paper = require("lualine.themes.kanagawa-paper")
    kanagawa_paper.inactive.a.fg = "#ff0000"
    kanagawa_paper.inactive.a.bg = "#ffffff"

    return {
      options = {
        theme = kanagawa_paper,
        ...
      }

Besides the special case of lualine, heres how you would adjust colours in general...

Lets say you want to change the bg colour of floating windows, which is defined in the theme file here. You have a couple of options:

Option 1: retarget the theme color

In your config for this plugin, you can set ui.float.bg to anything you want. That will change the colour for floating window backgrounds. Example:

return {
    "sho-87/kanagawa-paper.nvim",
    opts = {
      colors = {
        theme = {
          ui = {
            float = {
              bg = "#ff0000",
            },
          },
        },
      },
    },
  }

Option 2: retarget the palette color

This is more extreme. Notice that by default ui.float.bg is assigned to palette.sumiInk4. What you can do is redefine the value of palette.sumiInk4. This will change the value of the base colour, so any other place that uses sumiInk4 will also be changed:

return {
    "sho-87/kanagawa-paper.nvim",
    opts = {
      transparent = false,
      colors = {
        palette = {
          sumiInk4 = "#ff0000",
        },
      },
    },
  }

Note

If you use transparency mode, using either option above might not seem to do anything (especially in the case of bg colors). This is because of how transparency mode works, which just sets bg color to none. Transparency mode can be a bit finicky in general because of how different plugins do transparency

plague-doctor commented 2 months ago

Perfect! Thank you kindly for elaborative explanation :pray: Maybe next time I will be able to send a PR instead :-)