diff --git a/src-ui/components/HeaderRegion.cpp b/src-ui/components/HeaderRegion.cpp index 7f31ed92..f6458f47 100644 --- a/src-ui/components/HeaderRegion.cpp +++ b/src-ui/components/HeaderRegion.cpp @@ -150,7 +150,7 @@ HeaderRegion::HeaderRegion(SCXTEditor *e) : HasEditor(e) editor->themeApplier.applyHeaderTheme(this); editor->themeApplier.setLabelToHighlight(cpuLevel.get()); editor->themeApplier.setLabelToHighlight(ramLevel.get()); - editor->themeApplier.setGlyphButtonToAccent(scMenu.get()); + editor->themeApplier.applyHeaderSCButtonTheme(scMenu.get()); } HeaderRegion::~HeaderRegion() diff --git a/src-ui/theme/ThemeApplier.cpp b/src-ui/theme/ThemeApplier.cpp index 39fa0278..00c71374 100644 --- a/src-ui/theme/ThemeApplier.cpp +++ b/src-ui/theme/ThemeApplier.cpp @@ -130,26 +130,23 @@ static constexpr sheet_t::Class TextPushButton{"header.textbutton"}; static constexpr sheet_t::Class ToggleButton{"header.togglebutton"}; static constexpr sheet_t::Class MenuButton{"header.menubutton"}; static constexpr sheet_t::Class GlyphButton{"header.menubutton"}; -void applyColors(const sheet_t::ptr_t &, const ColorMap &); +static constexpr sheet_t::Class GlyphButtonAccent{"header.menubutton.accent"}; +void applyColorsAndFonts(const sheet_t::ptr_t &, const ColorMap &, const ThemeApplier &); void init() { sheet_t::addClass(TextPushButton).withBaseClass(jcmp::TextPushButton::Styles::styleClass); sheet_t::addClass(ToggleButton).withBaseClass(jcmp::ToggleButton::Styles::styleClass); sheet_t::addClass(MenuButton).withBaseClass(jcmp::MenuButton::Styles::styleClass); sheet_t::addClass(GlyphButton).withBaseClass(jcmp::GlyphButton::Styles::styleClass); + sheet_t::addClass(GlyphButtonAccent).withBaseClass(GlyphButton); } } // namespace header namespace util { static constexpr sheet_t::Class LabelHighlight("util.label.highlight"); -static constexpr sheet_t::Class GlyphButtonAccent("util.glyphbutton.accent"); void applyColors(const sheet_t::ptr_t &, const ColorMap &); -void init() -{ - sheet_t::addClass(LabelHighlight).withBaseClass(jcmp::Label::Styles::styleClass); - sheet_t::addClass(GlyphButtonAccent).withBaseClass(jcmp::GlyphButton::Styles::styleClass); -} +void init() { sheet_t::addClass(LabelHighlight).withBaseClass(jcmp::Label::Styles::styleClass); } } // namespace util } // namespace detail @@ -175,7 +172,7 @@ void ThemeApplier::recolorStylesheet(const sst::jucegui::style::StyleSheet::ptr_ detail::multi::applyColors(s, *colors); detail::multi::zone::applyColors(s, *colors); detail::multi::group::applyColors(s, *colors); - detail::header::applyColors(s, *colors); + detail::header::applyColorsAndFonts(s, *colors, *this); detail::util::applyColors(s, *colors); } @@ -238,12 +235,12 @@ void ThemeApplier::setLabelToHighlight(sst::jucegui::style::StyleConsumer *s) s->setCustomClass(detail::util::LabelHighlight); } -void ThemeApplier::setGlyphButtonToAccent(sst::jucegui::style::StyleConsumer *s) +void ThemeApplier::applyHeaderSCButtonTheme(sst::jucegui::style::StyleConsumer *s) { - s->setCustomClass(detail::util::GlyphButtonAccent); + s->setCustomClass(detail::header::GlyphButtonAccent); } -juce::Font ThemeApplier::interMediumFor(int ht) +juce::Font ThemeApplier::interMediumFor(int ht) const { static auto interMed = connectors::resources::loadTypeface("fonts/Inter/static/Inter-Medium.ttf"); @@ -466,16 +463,24 @@ void applyColors(const sheet_t::ptr_t &base, const ColorMap &cols) } // namespace multi namespace header { -void applyColors(const sheet_t::ptr_t &base, const ColorMap &cols) +void applyColorsAndFonts(const sheet_t::ptr_t &base, const ColorMap &cols, const ThemeApplier &t) { base->setColour(TextPushButton, jcmp::TextPushButton::Styles::fill, cols.get(ColorMap::bg_2)); base->setColour(TextPushButton, jcmp::TextPushButton::Styles::fill_hover, cols.get(ColorMap::bg_3)); + base->setFont(TextPushButton, jcmp::TextPushButton::Styles::labelfont, t.interMediumFor(14)); base->setColour(ToggleButton, jcmp::ToggleButton::Styles::fill, cols.get(ColorMap::bg_2)); base->setColour(ToggleButton, jcmp::ToggleButton::Styles::fill_hover, cols.get(ColorMap::bg_3)); + base->setFont(ToggleButton, jcmp::ToggleButton::Styles::labelfont, t.interMediumFor(14)); base->setColour(MenuButton, jcmp::MenuButton::Styles::fill, cols.get(ColorMap::bg_2)); + base->setFont(MenuButton, jcmp::MenuButton::Styles::labelfont, t.interMediumFor(14)); base->setColour(GlyphButton, jcmp::GlyphButton::Styles::fill, cols.get(ColorMap::bg_2)); base->setColour(GlyphButton, jcmp::GlyphButton::Styles::fill_hover, cols.get(ColorMap::bg_3)); + + base->setColour(GlyphButtonAccent, jcmp::GlyphButton::Styles::labelcolor, + cols.get(ColorMap::accent_1a)); + base->setColour(GlyphButtonAccent, jcmp::GlyphButton::Styles::labelcolor_hover, + cols.get(ColorMap::accent_1a)); } } // namespace header @@ -485,10 +490,6 @@ void applyColors(const sheet_t::ptr_t &base, const ColorMap &cols) { base->setColour(LabelHighlight, jcmp::Label::Styles::labelcolor, cols.get(ColorMap::generic_content_highest)); - base->setColour(GlyphButtonAccent, jcmp::GlyphButton::Styles::labelcolor, - cols.get(ColorMap::accent_1a)); - base->setColour(GlyphButtonAccent, jcmp::GlyphButton::Styles::labelcolor_hover, - cols.get(ColorMap::accent_1a)); } } // namespace util } // namespace detail diff --git a/src-ui/theme/ThemeApplier.h b/src-ui/theme/ThemeApplier.h index 8eee6126..53e05dab 100644 --- a/src-ui/theme/ThemeApplier.h +++ b/src-ui/theme/ThemeApplier.h @@ -54,14 +54,14 @@ struct ThemeApplier void applyMixerEffectTheme(juce::Component *toThis); void applyMixerChannelTheme(juce::Component *toThis); void applyHeaderTheme(juce::Component *toThis); + void applyHeaderSCButtonTheme(sst::jucegui::style::StyleConsumer *); // Some utilities to move single items void setLabelToHighlight(sst::jucegui::style::StyleConsumer *); - void setGlyphButtonToAccent(sst::jucegui::style::StyleConsumer *); const std::unique_ptr &colorMap() { return colors; } - juce::Font interMediumFor(int ht); + juce::Font interMediumFor(int ht) const; protected: std::unique_ptr colors;