olimorris / onedarkpro.nvim

🎨 Atom's iconic One Dark theme. Cacheable, fully customisable, Tree-sitter and LSP semantic token support. Comes with variants
MIT License
791 stars 42 forks source link

Can't set blend highlight option #88

Closed petobens closed 2 years ago

petobens commented 2 years ago

If I add the following highlight group:

CmpPmenu = { fg = p.fg, bg = p.bg, blend = 30 },

then onedark pro errors out. However blend is a valid option as per :h highlight-blend and the following works:

vim.api.nvim_set_hl(0, 'CmpPmenu', { fg = p.fg, bg = p.bg, blend = 7 })

So I guess onedarkpro is lacking support for the blend option. Can you please add it? Thanks in advance!

olimorris commented 2 years ago

As always, a great spot! Can you check if the latest commit has resolved this?

petobens commented 2 years ago

With the following minimal.lua file:

local fn = vim.fn

-- Ignore default config and plugins and define new dirs
local test_dir = '/tmp/nvim-minimal'
vim.opt.runtimepath:remove(fn.expand('~/.config/nvim'))
vim.opt.packpath:remove(fn.expand('~/.local/share/nvim/site'))
vim.opt.runtimepath:append(fn.expand(test_dir))
vim.opt.packpath:append(fn.expand(test_dir))

-- Install packer
local install_path = test_dir .. '/pack/packer/start/packer.nvim'
if fn.empty(fn.glob(install_path)) > 0 then
    packer_bootstrap = fn.system({
        'git',
        'clone',
        '--depth',
        '1',
        'https://github.com/wbthomason/packer.nvim',
        install_path,
    })
    vim.cmd([[packadd packer.nvim]])
end

-- Setup packer
local packer = require('packer')
packer.init({
    package_root = test_dir .. '/pack',
    compile_path = test_dir .. '/plugin/packer_compiled.lua',
})
packer.startup(function(use)
    -- Packer can manage itself
    use('wbthomason/packer.nvim')

    use({ 'olimorris/onedarkpro.nvim' })

    -- Auto install plugins
    if packer_bootstrap then
        packer.sync()
    end
end)

-- Plugin setup
local ok, onedarkpro = pcall(require, 'onedarkpro')
if ok then
    local p = {
        dark_red = '#be5046',
    }
    onedarkpro.setup({
        theme = 'onedark',
        colors = p,
        highlights = {
            NormalFloat = { fg = p.dark_red, blend = 10 },
        },
    })
    onedarkpro.load()
end

I'm getting this error:

Error detected while processing /home/pedro/git-repos/private/dotfiles/nvim/minimal.lua:
E5113: Error while calling lua chunk: .../start/onedarkpro.nvim/lua/onedarkpro/utils/variable.lua:26: bad argument #1 to 'pairs' (table expected, got number)
stack traceback:
        [C]: in function 'pairs'
        .../start/onedarkpro.nvim/lua/onedarkpro/utils/variable.lua:26: in function 'replace_vars'
        .../start/onedarkpro.nvim/lua/onedarkpro/utils/variable.lua:27: in function 'replace_vars'
        .../start/onedarkpro.nvim/lua/onedarkpro/utils/variable.lua:27: in function 'apply'
        ...ack/packer/start/onedarkpro.nvim/lua/onedarkpro/init.lua:83: in function 'load'
        /home/pedro/git-repos/private/dotfiles/nvim/minimal.lua:55: in main chunk

Dunno if I'm doing something wrong? Thanks for the quick turnaround.

olimorris commented 2 years ago

Sorry, my bad! Was a little too hasty to add the blend option. Also added in some tests so please let me know if this works!

petobens commented 2 years ago

Thanks!