Finish up theme printer

This commit is contained in:
Marshall Bowers
2023-11-02 19:14:51 -04:00
parent fc376287e0
commit d1636bf16b
3 changed files with 73 additions and 7 deletions
+20 -3
View File
@@ -2,10 +2,18 @@ use std::fmt::{self, Debug};
use gpui::{Hsla, Rgba};
use theme::{
GitStatusColors, PlayerColor, PlayerColors, StatusColors, SyntaxTheme, SystemColors,
ThemeColors, ThemeFamily, ThemeStyles, ThemeVariant,
Appearance, GitStatusColors, PlayerColor, PlayerColors, StatusColors, SyntaxTheme,
SystemColors, ThemeColors, ThemeFamily, ThemeStyles, ThemeVariant,
};
struct RawSyntaxPrinter<'a>(&'a str);
impl<'a> Debug for RawSyntaxPrinter<'a> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.0)
}
}
struct HslaPrinter(Hsla);
impl Debug for HslaPrinter {
@@ -55,6 +63,7 @@ impl Debug for ThemeFamilyPrinter {
.collect(),
),
)
.field("scales", &RawSyntaxPrinter("default_color_scales()"))
.finish()
}
}
@@ -66,12 +75,20 @@ impl<'a> Debug for ThemeVariantPrinter<'a> {
f.debug_struct("ThemeVariant")
.field("id", &IntoPrinter(&self.0.id))
.field("name", &IntoPrinter(&self.0.name))
.field("appearance", &self.0.appearance)
.field("appearance", &AppearancePrinter(self.0.appearance))
.field("styles", &ThemeStylesPrinter(&self.0.styles))
.finish()
}
}
pub struct AppearancePrinter(Appearance);
impl Debug for AppearancePrinter {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "Appearance::{:?}", self.0)
}
}
pub struct ThemeStylesPrinter<'a>(&'a ThemeStyles);
impl<'a> Debug for ThemeStylesPrinter<'a> {