cargo-features-manager 0.12.0

A tui tool to enable/disable & prune dependency features
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use console::style;

pub fn highlight_search(text: &str, highlighted_letters: &[usize], is_dark: bool) -> String {
    text.chars()
        .enumerate()
        .map(|(index, c)| {
            match (is_dark, highlighted_letters.contains(&index)) {
                (false, true) => style(c).red().to_string(),
                (false, false) => c.to_string(),
                //dark red
                (true, true) => style(c).color256(1).to_string(),
                //light gray
                (true, false) => style(c).color256(8).to_string(),
            }
        })
        .collect()
}