|
74 | 74 |
|
75 | 75 | ---@param blend BlendOptions |
76 | 76 | ---@param default_hi DefaultHighlights |
77 | | -function M.setup_highlights(blend, default_hi, transparent_bg, transparent_cursorline) |
78 | | - -- Get base colors |
| 77 | +function M.setup_highlights(blend, default_hi, transparent_bg) |
| 78 | + if not transparent_bg then |
| 79 | + transparent_bg = false |
| 80 | + end |
| 81 | + |
| 82 | + if blend.factor == 0 then |
| 83 | + transparent_bg = true |
| 84 | + end |
| 85 | + |
| 86 | + local cursorline_hl = get_highlight("CursorLine") |
| 87 | + local is_cursorline_enabled = vim.opt.cursorline:get() |
| 88 | + local has_cursorline_bg = cursorline_hl.bg ~= "None" |
| 89 | + |
| 90 | + local cursor_line_color = (is_cursorline_enabled and has_cursorline_bg) and cursorline_hl |
| 91 | + or { bg = "None" } |
| 92 | + |
79 | 93 | local colors = { |
80 | 94 | error = get_highlight(default_hi.error), |
81 | 95 | warn = get_highlight(default_hi.warn), |
82 | 96 | info = get_highlight(default_hi.info), |
83 | 97 | hint = get_highlight(default_hi.hint), |
84 | 98 | ok = get_highlight(default_hi.ok), |
85 | 99 | arrow = get_highlight(default_hi.arrow), |
86 | | - cursor_line = transparent_cursorline and { bg = "None" } or get_highlight("CursorLine"), |
| 100 | + cursor_line = cursor_line_color, |
87 | 101 | } |
88 | 102 |
|
89 | | - if not transparent_bg then |
90 | | - transparent_bg = false |
91 | | - end |
92 | | - |
93 | | - if blend.factor == 0 then |
94 | | - transparent_bg = true |
95 | | - end |
96 | | - |
97 | 103 | -- Get special colors |
98 | 104 | colors.background = get_background_color(default_hi.background) |
99 | 105 | colors.mixing_color = get_mixing_color(default_hi.mixing_color) |
|
127 | 133 | function M.get_diagnostic_highlights(blend_factor, diag_ret, curline, index_diag) |
128 | 134 | local diag_hi, diag_inv_hi, body_hi = M.get_diagnostic_highlights_from_severity(diag_ret.severity) |
129 | 135 |
|
130 | | - if (diag_ret.line and diag_ret.line == curline) and index_diag == 1 and blend_factor == 0 then |
131 | | - diag_hi = diag_hi .. "CursorLine" |
| 136 | + if (diag_ret.line and diag_ret.line == curline) and index_diag == 1 then |
| 137 | + if blend_factor == 0 then |
| 138 | + diag_hi = diag_hi .. "CursorLine" |
| 139 | + end |
| 140 | + diag_inv_hi = diag_inv_hi .. "CursorLine" |
132 | 141 | end |
133 | 142 |
|
134 | 143 | if |
|
0 commit comments