Merge pull request #37 from christopher-l/reverse_colors

Fix popup colors not being reversed
This commit is contained in:
daa84 2017-12-26 18:36:19 +03:00 committed by GitHub
commit 0f44b1a193
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 4 deletions

View File

@ -57,10 +57,14 @@ fn get_hl_colors(nvim: &mut Neovim, hl: &str) -> (Option<Color>, Option<Color>)
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
})