sainnhe / sonokai

High Contrast & Vivid Color Scheme based on Monokai Pro
MIT License
1.65k stars 119 forks source link

Configuration for dim float window style #90

Closed ten3roberts closed 1 year ago

ten3roberts commented 1 year ago

Floating windows need to stand out, and this is currently done by making them lighter than Normal

It would be useful with a configuration variable that makes the floating windows and borders darker.

This would make the highlighting consistent with NvimTree etc.

I prefer this style of having "util" or non-text windows darker.

Something along the lines of

g:sonokai_float_style=dim/bright
antoineco commented 1 year ago

@ten3roberts dark floating windows is a popular style indeed. The current style pre-dates the addition of bg_dim to the palette (78daf8e71cb0c83abaf9f7863dfcec7c2bd6baf3), but now a "dark" float style should be totally achievable.

Would you mind trying this autocmd (assuming Neovim) and report on potential inconsistencies? (especially if you use fancy borders around floating windows). I'll do the same on my side.

vim.api.nvim_create_autocmd("ColorScheme", {
  group = vim.api.nvim_create_augroup("custom_highlights_sonokai", {}),
  pattern = "sonokai",
  callback = function()
    local config = vim.fn["sonokai#get_configuration"]()
    local palette = vim.fn["sonokai#get_palette"](config.style, config.colors_override)
    local set_hl = vim.fn["sonokai#highlight"]

    set_hl("NormalFloat", palette.fg,   palette.bg_dim)
    set_hl("FloatBorder", palette.grey, palette.bg_dim)

    --[[ unnecessary on latest 'main'
    set_hl("ErrorFloat",   palette.red,    palette.bg_dim)
    set_hl("WarningFloat", palette.yellow, palette.bg_dim)
    set_hl("InfoFloat",    palette.blue,   palette.bg_dim)
    set_hl("HintFloat",    palette.green,  palette.bg_dim)
    --]]
  end
})

before

image image

after

image image

ten3roberts commented 1 year ago

Sorry, this completely slipped my mind.

Saw the configuration option for dim floats, and it works wonderfully.

Thanks ❤️