better checking for color matches

This commit is contained in:
2024-12-09 18:02:10 -05:00
parent 65a91a51a0
commit 18e67b58dc

View File

@@ -46,12 +46,7 @@ async fn autocomplete_colors<'a>(
_ctx: Context<'_>, _ctx: Context<'_>,
partial: &'a str, partial: &'a str,
) -> impl Iterator<Item = &'static str> + use<'a> { ) -> impl Iterator<Item = &'static str> + use<'a> {
COLORS.clone().into_keys().filter(move |x| COLORS.clone().into_keys().filter(move |x| x.split_whitespace().any(|x| x.starts_with(partial)))
x.starts_with(partial)
|| x.starts_with(&format!("light {partial}"))
|| x.starts_with(&format!("lighter {partial}"))
|| x.starts_with(&format!("dark {partial}"))
|| x.starts_with(&format!("darker {partial}")))
} }
/// Change the color of your personal role /// Change the color of your personal role