eazygit 0.5.1

A fast TUI for Git with staging, conflicts, rebase, and palette-first UX
Documentation
//! Renderer utility functions.

use ratatui::layout::Rect;

/// Create a centered rectangle within the given area.
/// 
/// # Arguments
/// * `percent_x` - Width as percentage of area width
/// * `percent_y` - Height as percentage of area height
/// * `area` - The area to center within
pub fn center_rect(percent_x: u16, percent_y: u16, area: Rect) -> Rect {
    let popup_width = area.width * percent_x / 100;
    let popup_height = area.height * percent_y / 100;
    let x = area.x + (area.width.saturating_sub(popup_width)) / 2;
    let y = area.y + (area.height.saturating_sub(popup_height)) / 2;
    
    Rect {
        x,
        y,
        width: popup_width,
        height: popup_height,
    }
}