pub(crate) const TEXT_SCALE: f32 = 0.85;
pub(crate) const TEXT_HALF: f32 = 10.0 * TEXT_SCALE;
pub(crate) const PANEL_RADIUS: f32 = 10.0;
pub(crate) const CONTROL_RADIUS: f32 = 5.0;
pub(crate) const CHROME_TINT: [f32; 4] = [0.11, 0.11, 0.14, 0.97];
pub(crate) const PANEL_BORDER_WIDTH: f32 = 1.5;
pub(crate) const PANEL_BORDER_TINT: [f32; 4] = [0.30, 0.32, 0.40, 1.0];
pub(crate) const HOVER_TINT: [f32; 4] = [0.24, 0.27, 0.36, 0.9];
pub(crate) const SELECTED_TINT: [f32; 4] = [0.18, 0.28, 0.46, 1.0];
pub(crate) const BUTTON_TINT: [f32; 4] = [0.19, 0.20, 0.25, 1.0];
pub(crate) const ACCENT_TINT: [f32; 4] = [0.26, 0.42, 0.66, 1.0];
pub(crate) const LABEL: [f32; 3] = [0.90, 0.90, 0.92];
pub(crate) const LABEL_DIM: [f32; 3] = [0.60, 0.60, 0.66];
pub(crate) const HEADING: [f32; 3] = [0.93, 0.94, 0.97];
pub(crate) const LOG_INFO: [f32; 3] = LABEL;
pub(crate) const LOG_WARN: [f32; 3] = [0.95, 0.78, 0.45];
pub(crate) const LOG_ERROR: [f32; 3] = [0.95, 0.55, 0.55];
pub(crate) const LOG_COMMAND: [f32; 3] = [0.58, 0.72, 0.95];
pub(crate) const NOTIFY_INFO: [f32; 4] = [0.58, 0.72, 0.95, 1.0];
pub(crate) const NOTIFY_SUCCESS: [f32; 4] = [0.42, 0.72, 0.46, 1.0];
pub(crate) const NOTIFY_WARNING: [f32; 4] = [0.95, 0.78, 0.45, 1.0];
pub(crate) const NOTIFY_ERROR: [f32; 4] = [0.90, 0.42, 0.42, 1.0];
pub(crate) const HIGHLIGHT_INSET_X: f32 = 4.0;
pub(crate) const HIGHLIGHT_INSET_Y: f32 = 1.5;
pub(crate) fn highlight_rect(rect: [f32; 4]) -> [f32; 4] {
[
rect[0] + HIGHLIGHT_INSET_X,
rect[1] + HIGHLIGHT_INSET_Y,
(rect[2] - 2.0 * HIGHLIGHT_INSET_X).max(0.0),
(rect[3] - 2.0 * HIGHLIGHT_INSET_Y).max(0.0),
]
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn highlight_rect_insets_and_never_goes_negative() {
let r = highlight_rect([10.0, 20.0, 100.0, 28.0]);
assert_eq!(r[0], 10.0 + HIGHLIGHT_INSET_X);
assert_eq!(r[1], 20.0 + HIGHLIGHT_INSET_Y);
assert_eq!(r[2], 100.0 - 2.0 * HIGHLIGHT_INSET_X);
assert_eq!(r[3], 28.0 - 2.0 * HIGHLIGHT_INSET_Y);
let tiny = highlight_rect([0.0, 0.0, 2.0, 1.0]);
assert_eq!((tiny[2], tiny[3]), (0.0, 0.0));
}
}