utils.rs

 1//! UI-related utilities
 2
 3use gpui::App;
 4use theme::ActiveTheme;
 5
 6mod apca_contrast;
 7mod color_contrast;
 8mod constants;
 9mod corner_solver;
10mod format_distance;
11mod search_input;
12mod with_rem_size;
13
14pub use apca_contrast::*;
15pub use color_contrast::*;
16pub use constants::*;
17pub use corner_solver::{CornerSolver, inner_corner_radius};
18pub use format_distance::*;
19pub use search_input::*;
20pub use with_rem_size::*;
21
22/// Returns true if the current theme is light or vibrant light.
23pub fn is_light(cx: &mut App) -> bool {
24    cx.theme().appearance.is_light()
25}
26
27/// Returns the platform-appropriate label for the "reveal in file manager" action.
28pub fn reveal_in_file_manager_label(is_remote: bool) -> &'static str {
29    if cfg!(target_os = "macos") && !is_remote {
30        "Reveal in Finder"
31    } else if cfg!(target_os = "windows") && !is_remote {
32        "Reveal in File Explorer"
33    } else {
34        "Reveal in File Manager"
35    }
36}