Sort themes by light/dark first and then alphabetically

This commit is contained in:
Antonio Scandurra 2022-04-26 12:08:41 +02:00
parent d8eb749640
commit bf27edfdee

View file

@ -36,7 +36,12 @@ impl ThemeSelector {
let handle = cx.weak_handle();
let picker = cx.add_view(|cx| Picker::new(handle, cx));
let original_theme = cx.global::<Settings>().theme.clone();
let theme_names = registry.list().collect::<Vec<_>>();
let mut theme_names = registry.list().collect::<Vec<_>>();
theme_names.sort_unstable_by(|a, b| {
a.ends_with("dark")
.cmp(&b.ends_with("dark"))
.then_with(|| a.cmp(&b))
});
let matches = theme_names
.iter()
.map(|name| StringMatch {