Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bad argument #2 to 'blend' (no value) #20

Closed
danielnehrig opened this issue Sep 9, 2021 · 3 comments
Closed

bad argument #2 to 'blend' (no value) #20

danielnehrig opened this issue Sep 9, 2021 · 3 comments

Comments

@danielnehrig
Copy link

danielnehrig commented Sep 9, 2021

Error: EError running notification service: ...opt/nvim-notify/lua/notify/service/buffer/highlights.lua:59: bad argument #2 to 'blend' (no value)

the highlight used for notify because normal is none for me

cmd("autocmd ColorScheme * highlight NotifyBG guibg=#3d3d3d guifg=#3e4451")

code in context

function Make:Report(msg)
    vim.cmd [[packadd nvim-notify]]
    local opt = {
        title = "Neomake"
    }
    local info = vim.g.neomake_hook_context.jobinfo
    local notify = require("notify")
    notify.setup(
        {
            -- Animation style (see below for details)
            stages = "fade",
            -- Default timeout for notifications
            timeout = 3000,
            -- For stages that change opacity this is treated as the highlight behind the window
            background_colour = "NotifyBG",
            -- Icons for the different levels
            icons = {
                ERROR = "",
                WARN = "",
                INFO = "",
                DEBUG = "",
                TRACE = ""
            }
        }
    )
    if info.exit_code == 0 then
        notify("Job Finished Successfully", _, opt)
    elseif info.exit_code == 1 then
        notify("Job Failed", "error", opt)
    else
        notify("Job Started", "log", opt)
    end
end
@rcarriga
Copy link
Owner

rcarriga commented Sep 9, 2021

This should be solved by #19, please try the latest commit

@danielnehrig
Copy link
Author

can confirm works now thanks

@wookayin
Copy link
Contributor

wookayin commented Oct 26, 2021

With the latest commit as of 10/26/2021, I am still seeing this error. The background_colour highlight group reads like hi NotifyBG guibg=#1a2a31. Why would be that?

Highlight group 'Normal' has no background highlight.

Please provide an RGB hex value or highlight group with a background value for 'background_colour' option

Defaulting to #000000
Error running notification service: ...ged/nvim-notify/lua/notify/service/buffer/highlights.lua:59: bad argument #2 to 'blend' (no value)

After the warning, require("notify.config").background_colour() evaluates to #000000 .

UPDATE: This is because I had hi Normal ... guifg=white and parsing named colors (white) into hex gives a wrong result. Sanity check required -- I will submit a PR soon.

wookayin added a commit to wookayin/nvim-notify that referenced this issue Oct 26, 2021
Previously the foreground/background color only in the form of hexcode
were supported, not named colors. This would lead to a strange error
like `bad argument \rcarriga#2 to 'blend' (no value)` (See rcarriga#20).

When named colors are given, they will be resolved to a hex code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants