From 09b8253745c84a0fce47624acc92dc1d8e1fbad8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christopher=20L=C3=BCbbemeier?= Date: Sun, 24 Dec 2017 15:11:37 +0100 Subject: [PATCH] Fix popup colors not being reversed --- src/theme.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/theme.rs b/src/theme.rs index 92c7d92..6a74fe7 100644 --- a/src/theme.rs +++ b/src/theme.rs @@ -57,10 +57,14 @@ fn get_hl_colors(nvim: &mut Neovim, hl: &str) -> (Option, Option) nvim.get_hl_by_name(hl, true) .ok_and_report() .and_then(|m| if let Some(m) = m.to_attrs_map_report() { - Some(( - get_hl_color(&m, "background"), - get_hl_color(&m, "foreground"), - )) + let reverse = m.get("reverse").and_then(|v| v.as_bool()).unwrap_or(false); + let bg = get_hl_color(&m, "background"); + let fg = get_hl_color(&m, "foreground"); + if reverse { + Some((fg, bg)) + } else { + Some((bg, fg)) + } } else { None })