File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -88,6 +88,12 @@ function M.clear_cache()
8888 cache = {}
8989end
9090
91+ local function resolve_color (str )
92+ if not str then return nil end
93+ if str :match (" ^#" ) then return str end
94+ return get_hl_color (str , " bg" )
95+ end
96+
9197function M .get_color_at_cursor ()
9298 local cursor = vim .api .nvim_win_get_cursor (0 )
9399 cursor [1 ] = cursor [1 ] - 1
115121--- @param opts ? { level ?: number , inverted ?: boolean }
116122function M .get_hl_group (opts )
117123 opts = opts or {}
118- local _cursor_color = (vim .api .nvim_get_mode ().mode == " i" ) and C .cursor_color_insert_mode or C .cursor_color
124+ local _cursor_color = (vim .api .nvim_get_mode ().mode == " i" ) and resolve_color (C .cursor_color_insert_mode )
125+ or resolve_color (C .cursor_color )
119126
120127 local hl_group = (" SmearCursor%s%s" ):format (opts .inverted and " Inverted" or " " , tostring (opts .level or " " ))
121128
You can’t perform that action at this time.
0 commit comments