improve theming
* add option to center center vertically, this makes it possible to show full screen dialogs which centered elements. i.e. for an exit dialog * improve dynamic line and update themes
This commit is contained in:
parent
db2ae90268
commit
4b33e3e44e
5 changed files with 27 additions and 12 deletions
|
@ -3,3 +3,4 @@ allow_images=true
|
|||
term="kitty -e"
|
||||
insensitive=true
|
||||
key_detection_type="Code"
|
||||
lines_size_factor=1.9
|
||||
|
|
|
@ -4,3 +4,4 @@ term="kitty -e"
|
|||
insensitive=true
|
||||
key_detection_type="Code"
|
||||
blurred_background=false
|
||||
lines_size_factor=1.9
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
* {
|
||||
font-family: var(--font);
|
||||
box-sizing: border-box;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
#background {
|
||||
|
@ -79,8 +80,6 @@
|
|||
background-color: rgba(32, 32, 32, 0);
|
||||
padding: 1rem;
|
||||
margin: 1rem;
|
||||
border-radius: 0.5rem;
|
||||
border-bottom: 5px solid rgba(32, 32, 32, 0.1);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
|
@ -96,7 +95,7 @@
|
|||
#entry:selected {
|
||||
color: #fff;
|
||||
background-color: var(--entry-selected);
|
||||
border-bottom: 5px solid var(--search-border);
|
||||
border-bottom: 3px solid var(--search-border);
|
||||
border-bottom-left-radius: 0;
|
||||
border-bottom-right-radius: 0;
|
||||
}
|
||||
|
@ -120,4 +119,5 @@
|
|||
#row:hover {
|
||||
background-color: transparent;
|
||||
outline: inherit;
|
||||
border-width: 0;
|
||||
}
|
||||
|
|
|
@ -307,6 +307,10 @@ pub struct Config {
|
|||
#[clap(long = "line-additional-space")]
|
||||
lines_additional_space: Option<i32>,
|
||||
|
||||
/// factor to multiple the line height with.
|
||||
#[clap(long = "lines-size-factor")]
|
||||
lines_size_factor: Option<f64>,
|
||||
|
||||
#[clap(short = 'w', long = "columns")]
|
||||
columns: Option<u32>,
|
||||
|
||||
|
@ -333,6 +337,10 @@ pub struct Config {
|
|||
#[clap(long = "content-halign")]
|
||||
content_halign: Option<Align>,
|
||||
|
||||
/// center content on vertical axis
|
||||
#[clap(long = "content-vcenter")]
|
||||
content_vcenter: Option<bool>,
|
||||
|
||||
/// Vertical alignment
|
||||
#[clap(long = "valign")]
|
||||
valign: Option<Align>,
|
||||
|
@ -490,6 +498,11 @@ impl Config {
|
|||
self.content_halign.unwrap_or(Align::Fill)
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn content_vcenter(&self) -> bool {
|
||||
self.content_vcenter.unwrap_or(false)
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn valign(&self) -> Align {
|
||||
self.valign.unwrap_or(Align::Center)
|
||||
|
@ -642,6 +655,11 @@ impl Config {
|
|||
self.lines_additional_space.unwrap_or(0)
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn lines_size_factor(&self) -> f64 {
|
||||
self.lines_size_factor.unwrap_or(1.4)
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn version(&self) -> bool {
|
||||
self.version
|
||||
|
|
|
@ -777,7 +777,7 @@ fn build_main_box<T: Clone + 'static>(config: &Config, ui_elements: &Rc<UiElemen
|
|||
ui_elements.main_box.set_widget_name("inner-box");
|
||||
ui_elements.main_box.set_css_classes(&["inner-box"]);
|
||||
ui_elements.main_box.set_hexpand(true);
|
||||
ui_elements.main_box.set_vexpand(false);
|
||||
ui_elements.main_box.set_vexpand(config.content_vcenter());
|
||||
|
||||
ui_elements
|
||||
.main_box
|
||||
|
@ -1258,15 +1258,10 @@ fn calculate_row_height<T: Clone + 'static>(
|
|||
.find_map(|(fb, _)| {
|
||||
let (_, _, _, baseline) = fb.measure(Orientation::Vertical, MEAS_SIZE);
|
||||
if baseline > 0 {
|
||||
let factor = if lines > 1 {
|
||||
1.4 // todo find a better way to do this
|
||||
// most likely it will not work with all styles
|
||||
} else {
|
||||
1.0
|
||||
};
|
||||
let factor = config.lines_size_factor();
|
||||
|
||||
if config.allow_images() && baseline < i32::from(config.image_size()) {
|
||||
Some(i32::from(config.image_size()))
|
||||
Some((f64::from(i32::from(config.image_size())) * factor) as i32)
|
||||
} else {
|
||||
Some((f64::from(baseline) * factor) as i32)
|
||||
}
|
||||
|
@ -1283,7 +1278,7 @@ fn calculate_row_height<T: Clone + 'static>(
|
|||
};
|
||||
|
||||
log::debug!(
|
||||
"heights: scroll {scroll_height}, window {window_height}, keys {height_box}, height {height:?}"
|
||||
"heights: scroll {scroll_height}, window {window_height}, keys {height_box}, height {height:?}, lines {lines:?}"
|
||||
);
|
||||
|
||||
height_box
|
||||
|
|
Loading…
Add table
Reference in a new issue