Skip to repository content59 lines · 1.5 KB · rust
tenant.openagents/omega
No repository description is available.
OpenAgents Git authority 2026-07-28T02:33:04.212Z Public web read
NIP-34 coordinate
30617:7649603503856e5148d571eac2766b288a8ff1e9e35d380337a1d2b0015b4f92:omegaMaintainersHidden in public view
References2 branches · 1 tag
Read-only clone
git clone https://openagents.com/git/tenant.openagents/omega.gitBrowse files
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}
37
38/// Capitalizes the first character of a string.
39///
40/// This function takes a string slice as input and returns a new `String` with the first character
41/// capitalized.
42///
43/// # Examples
44///
45/// ```
46/// use ui::utils::capitalize;
47///
48/// assert_eq!(capitalize("hello"), "Hello");
49/// assert_eq!(capitalize("WORLD"), "WORLD");
50/// assert_eq!(capitalize(""), "");
51/// ```
52pub fn capitalize(str: &str) -> String {
53 let mut chars = str.chars();
54 match chars.next() {
55 None => String::new(),
56 Some(first_char) => first_char.to_uppercase().collect::<String>() + chars.as_str(),
57 }
58}
59