xiyaowong / transparent.nvim

Remove all background colors to make nvim transparent
806 stars 23 forks source link

Only focus window is transparent #20

Closed groteck closed 1 year ago

groteck commented 1 year ago

Hi, I have a similar issue than here #8, but I think is caused for some collision with tint, after nvim fully loads then I run :lua require('transparent').toggle_transparent(true) and all works fine, but if I just leave all set I think the plugin fights with the dim feature.

-- Colors
vim.t_Co = 256
vim.opt.syntax = 'enable'
vim.opt.colorcolumn = '80'
vim.opt.hlsearch = true
vim.cmd.colorscheme "catppuccin-mocha"
vim.opt.termguicolors = true -- set termguicolors to enable highlight groups

-- Transparent background
vim.g.transparent_enabled = true

--- Catppuccin theme config
require("catppuccin").setup({
    transparent_background = vim.g.transparent_enabled,
    show_end_of_buffer = true, -- show the '~' characters after the end of buffers
    term_colors = true,
    integrations = {
        -- For plugins integrations (https://github.com/catppuccin/nvim#integrations)
        cmp = true,
        gitsigns = true,
        nvimtree = true,
        telescope = true,
        notify = true,
        treesitter = true,
        treesitter_context = true,
        ts_rainbow = true,
        overseer = true,
        illuminate = true,
        neotest = true,
        native_lsp = {
            enabled = true,
            virtual_text = {
                errors = { "italic" },
                hints = { "italic" },
                warnings = { "italic" },
                information = { "italic" },
            },
            underlines = {
                errors = { "underline" },
                hints = { "underline" },
                warnings = { "underline" },
                information = { "underline" },
            },
        },
        indent_blankline = {
            enabled = true,
            colored_indent_levels = true,
        },

    },
})

-- Dim inactive window
require('tint').setup({
    tint_background_colors = false,
    tint = -45, -- Darken colors, use a positive value to brighten
    saturation = 0.5, -- Saturation to preserve
});

-- On window enter retrigger transparent background
vim.api.nvim_create_autocmd({ "WinEnter", "WinLeave", "WinNew", "VimEnter" }, {
    pattern = { "*" },
    callback = function()
        require('transparent').toggle_transparent(true)
    end,
})

I tried with an autocmd but also didn't seem to work.

https://user-images.githubusercontent.com/833030/214908410-81950eea-c8a6-4854-bf78-41bd83f6fa8f.mp4

xiyaowong commented 1 year ago

Possible conflicting autocommands

xiyaowong commented 1 year ago

this plugin only set bg color to none