1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use crate::color::*;
use crate::styled_char::StyledChar;

/// A scrollbar style defined by two styled chars, one
///  for the track, and one for the thumb.
///
/// For the default styling only the fg color is defined
///  and the char is ▐ but everything can be changed.
#[derive(Clone)]
pub struct ScrollBarStyle {
    pub track: StyledChar,
    pub thumb: StyledChar,
}

impl ScrollBarStyle {
    pub fn new() -> Self {
        let char = '▐';
        Self {
            track: StyledChar::from_fg_char(gray(5), char),
            thumb: StyledChar::from_fg_char(gray(21), char),
        }
    }
}

impl Default for ScrollBarStyle {
    fn default() -> Self {
        Self::new()
    }
}