echasnovski / mini.nvim

Library of 40+ independent Lua modules improving overall Neovim (version 0.8 and higher) experience with minimal effort
MIT License
5.13k stars 185 forks source link

Transparency and Dim Inactive support for mini colorscheme #162

Closed vihu closed 1 year ago

vihu commented 1 year ago

Contributing guidelines

Module(s)

mini.base16

Description

Thank you for your excellent plugin suite. I was wondering if you could add two extra config parameters for mini.base16, specifically:

For reference, I added the two options for gruvbox here, it would be really nice to support these for mini colorscheme as well :)

echasnovski commented 1 year ago

Thanks for suggestion! It seems like a small but valuable change. I'll think it through and test it for some time. Your reference PR is very handy, thanks!

echasnovski commented 1 year ago

I have two thoughts about this right now:

Am I missing something here?

echasnovski commented 1 year ago

I've given this some thought and I think it is better to not include both dimming and transparency in the 'mini.base16' config.

The reason for dimming is as stated earlier: there is no color in base16 palette that can be used for dimmed background.

The reason for transparency is that it indeed seems to be a case of "disabling" Normal highlight group. Thus can be done with a described highlight call (possibly inside autocommand).

Thank you for taking interest in improving 'mini.base16'.

prescientmoon commented 9 months ago

Hi @echasnovski !

Disabling the normal group does not seem to be enough. Example screenshot: image

Here's the same screenshot with the dedicated catppuccin theme: image

echasnovski commented 9 months ago

Disabling the normal group does not seem to be enough. Example screenshot:

Yes, indeed it is not quite enough to achieve 100% transparency, but it is close. Since this issue was closed I've added 'mini.colors' which has the ability to add transparency to any color scheme. So I'd suggest either use it directly (in a form of creating and managing your own color scheme file) or clear highlight groups which bother with not being transparent (here is a list from 'mini.colors' implementation).

prescientmoon commented 9 months ago

Hi again!

I was able to use mini.colors, although it's still missing a few areas image

(in this instance, telescope and the gitsigns column thingy)

I'm not sure how I'd even go about finding what the names of those highlight groups is. I'm also not sure how I'd go about fixing bad contrast areas like this one in the mini statusbar: image

Who knows, perhaps generic generated colorschemes can't look quite as good as handmade ones, although that's a bit sad.

If it helps in any way, here's my current colorscheme file:

local base16 = require("mini.base16")
local colors = require("mini.colors")

base16.setup({ palette = ... })

colors
  .get_colorscheme()
  :add_transparency({
    general = true,
    float = true,
    statuscolumn = true,
    statusline = true,
    tabline = true,
    winbar = true,
  })
  :apply()

vim.cmd([[highlight FloatBorder blend=0 guibg=NONE]])
vim.cmd([[highlight MiniStatuslineFilename blend=0 guibg=NONE]])
vim.cmd([[highlight Statusline blend=0 guibg=NONE]])
vim.cmd([[highlight StatuslineNC blend=0 guibg=NONE]])

The last 4 cmds were there from my time using the actual catppuccin theme, so I'm not 100% they are still needed.

prescientmoon commented 9 months ago

Looking at /etc/stylix/palette.html (which is a html preview of my current base16 theme), it does look like the backgrounds 03 and 04 have bad contrast with the text: image

Is this something normal, or is it an issue with the base16 theme itself?

echasnovski commented 9 months ago

(in this instance, telescope and the gitsigns column thingy)

I'm not sure how I'd even go about finding what the names of those highlight groups is.

If it is in the text where cursor can reach, there is an :Inspect command (in Neovim>=0.9) which shows highlighting at cursor.

Other than that, actual highlight group names should usually be mentioned in plugin's documentation. Another useful approach is to look at all defined highlight groups and see if they have relevant names and highlighting attributes. This can be done with plain :hi, :Pick hl_groups (with 'mini.pick'), or :Telescope highlights.

If it helps in any way, here's my current colorscheme file:

Although doable, I'd suggest to not have calls :add_transparency:apply() in the color scheme file. Although flexible and concise, this gets executed on every execution of script which is usually done on startup, thus increasing startup time couple of milliseconds.

Looking at /etc/stylix/palette.html (which is a html preview of my current base16 theme), it does look like the backgrounds 03 and 04 have bad contrast with the text:

Yes, to me first 8 colors doesn't look like a good choice for UI colors (according to Base16 styling).