Support opacity

This commit is contained in:
Jeremy Soller 2024-02-12 12:36:30 -07:00
parent c93032ab9d
commit 72c97fd5fc
No known key found for this signature in database
GPG key ID: D02FD439211AF56F
4 changed files with 86 additions and 24 deletions

View file

@ -70,6 +70,7 @@ pub struct Config {
pub bold_font_weight: u16,
pub font_stretch: u16,
pub font_size_zoom_step_mul_100: u16,
pub opacity: u8,
pub profiles: BTreeMap<ProfileId, Profile>,
pub show_headerbar: bool,
pub use_bright_bold: bool,
@ -90,6 +91,7 @@ impl Default for Config {
font_size_zoom_step_mul_100: 100,
font_stretch: Stretch::Normal.to_number(),
font_weight: Weight::NORMAL.0,
opacity: 100,
profiles: BTreeMap::new(),
show_headerbar: true,
syntax_theme_dark: "COSMIC Dark".to_string(),
@ -114,6 +116,10 @@ impl Config {
Metrics::new(font_size, line_height)
}
pub fn opacity_ratio(&self) -> f32 {
(self.opacity as f32) / 100.0
}
// Get a sorted and adjusted for duplicates list of profiles names and ids
pub fn profile_names(&self) -> Vec<(String, ProfileId)> {
let mut profile_names = Vec::<(String, ProfileId)>::with_capacity(self.profiles.len());