1use gpui::{App, Global, Hsla};
4use theme::Theme;
5
6pub type FindPaint = fn(theme: &Theme) -> (Hsla, Hsla);
9
10struct Installed(FindPaint);
11
12impl Global for Installed {}
13
14pub(crate) fn set_find_paint(cx: &mut App, paint: FindPaint) {
17 cx.set_global(Installed(paint));
18}
19
20pub fn find_washes(color: Hsla) -> (Hsla, Hsla) {
23 (color.opacity(0.22), color.opacity(0.48))
24}
25
26pub fn default_find(theme: &Theme) -> (Hsla, Hsla) {
28 find_washes(theme.accent)
29}
30
31pub(crate) fn find_paint_of(cx: &App) -> FindPaint {
32 cx.try_global::<Installed>()
33 .map_or(default_find, |installed| installed.0)
34}