rcarriga / nvim-notify

A fancy, configurable, notification manager for NeoVim
MIT License
2.97k stars 78 forks source link

Custome highlight in setup() #162

Closed rickywu closed 1 year ago

rickywu commented 1 year ago

I want to override highlight NotifyINFOTitle guifg=#A9FF68

because my backgroud is light color, so how should I do this?

I tried but not work

    vim.cmd([[
            hi default NotifyINFOTitle guifg=#4e9a06
        ]]),
rcarriga commented 1 year ago

Remove the default and it will override the highlight. See :hi-default

rickywu commented 1 year ago
    local notify = require("notify")
    local icons = {
        diagnostics = require("modules.ui.icons").get("diagnostics"),
        ui = require("modules.ui.icons").get("ui"),
    }

    notify.setup({
        ---@usage Animation style one of { "fade", "slide", "fade_in_slide_out", "static" }
        stages = "slide",
        ---@usage Function called when a new window is opened, use for changing win settings/config
        on_open = nil,
        ---@usage Function called when a window is closed
        on_close = nil,
        ---@usage timeout for notifications in ms, default 5000
        timeout = 2000,
        -- Render function for notifications. See notify-render()
        render = "default",
        ---@usage highlight behind the window for stages that change opacity
        background_colour = "Normal",
        ---@usage minimum width for notification windows
        minimum_width = 50,
        ---@usage notifications with level lower than this would be ignored. [ERROR > WARN > INFO > DEBUG > TRACE]
        level = "TRACE",
        ---@usage Icons for the different levels
        icons = {
            ERROR = icons.diagnostics.Error,
            WARN = icons.diagnostics.Warning,
            INFO = icons.diagnostics.Information,
            DEBUG = icons.ui.Bug,
            TRACE = icons.ui.Pencil,
        },
        vim.cmd([[
            hi NotifyINFOIcon guifg=#6b8e23
            hi NotifyINFOTitle guifg=#6b8e23
        ]]),
    vim.notify = notify

Did I missed anything? Still not work

rickywu commented 1 year ago

I found it use default hi color each time startup, and become customized hi color after isssue PackerSync Seems not override the default color when startup

rcarriga commented 1 year ago

Setting it before or after loading nvim-notify works just fine as long as default is not set. It sounds like you're not compiling your packer config (with PackerCompile) when testing and so you don't see the changes

rickywu commented 1 year ago

PackerSync also compile packages

The 1st time use PackerCompile image

2nd time seems works well image

After restart: image

rcarriga commented 1 year ago

I'm not sure what is going wrong but it is something wrong with your setup. It looks like the code is not being called for some reason. Closing this, but please re-open if you find an issue within nvim-notify

rickywu commented 1 year ago

Just put in colorscheme solved it