use gpui::{App, Global, Hsla};
use theme::Theme;
pub type FindPaint = fn(theme: &Theme) -> (Hsla, Hsla);
struct Installed(FindPaint);
impl Global for Installed {}
pub(crate) fn set_find_paint(cx: &mut App, paint: FindPaint) {
cx.set_global(Installed(paint));
}
pub fn find_washes(color: Hsla) -> (Hsla, Hsla) {
(color.opacity(0.22), color.opacity(0.48))
}
pub fn default_find(theme: &Theme) -> (Hsla, Hsla) {
find_washes(theme.accent)
}
pub(crate) fn find_paint_of(cx: &App) -> FindPaint {
cx.try_global::<Installed>()
.map_or(default_find, |installed| installed.0)
}