Skip to content

Commit

Permalink
Some more fonts and colors (surge-synthesizer#1067)
Browse files Browse the repository at this point in the history
  • Loading branch information
baconpaul authored Aug 3, 2024
1 parent a34258d commit 7cfd3c6
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 14 deletions.
1 change: 1 addition & 0 deletions resources/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ project(scxt-resources)

cmrc_add_resource_library(${PROJECT_NAME}
NAMESPACE scxt_resources
"fonts/Inter/static/Inter-Light.ttf"
"fonts/Inter/static/Inter-Regular.ttf"
"fonts/Inter/static/Inter-Medium.ttf"
"fonts/Inter/static/Inter-Bold.ttf"
Expand Down
30 changes: 19 additions & 11 deletions src-ui/components/multi/MappingPane.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ void Keyboard::paint(juce::Graphics &g)
}

constexpr auto lastOctave = 11;
auto font = editor->themeApplier.interMediumFor(13);
auto font = editor->themeApplier.interRegularFor(13);
for (int octave = 0; octave < lastOctave; ++octave)
{
assert(octave <= 10);
Expand Down Expand Up @@ -1449,15 +1449,23 @@ void MappingZones::paint(juce::Graphics &g)

auto r = rectangleForZone(z.second);

auto nonSelZoneColor = editor->themeColor(theme::ColorMap::generic_content_medium);
auto borderColor = editor->themeColor(theme::ColorMap::accent_1b);
auto fillColor = borderColor.withAlpha(0.2f);
auto textColor = editor->themeColor(theme::ColorMap::accent_1b);

if (drawSelected)
nonSelZoneColor = editor->themeColor(theme::ColorMap::accent_1a);
g.setColour(nonSelZoneColor.withAlpha(drawSelected ? 0.5f : 0.2f));
{
borderColor = editor->themeColor(theme::ColorMap::accent_1a);
fillColor = borderColor.withAlpha(0.5f);
textColor = editor->themeColor(theme::ColorMap::accent_1a);
}

g.setColour(fillColor);
g.fillRect(r);
g.setColour(nonSelZoneColor);
g.drawRect(r, 2.f);
g.setColour(nonSelZoneColor.brighter());
g.setFont(editor->themeApplier.interMediumFor(11));
g.setColour(borderColor);
g.drawRect(r, 1.f);
g.setColour(textColor);
g.setFont(editor->themeApplier.interRegularFor(11));
g.drawText(std::get<2>(z.second), r.reduced(5, 3), juce::Justification::topLeft);

auto ct = display->voiceCountFor(z.first);
Expand All @@ -1476,7 +1484,7 @@ void MappingZones::paint(juce::Graphics &g)

const auto &[kb, vel, name] = z.second;

auto selZoneColor = editor->themeColor(theme::ColorMap::accent_1b);
auto selZoneColor = editor->themeColor(theme::ColorMap::accent_1a);
auto c1{selZoneColor.withAlpha(0.f)};
auto c2{selZoneColor.withAlpha(0.5f)};

Expand Down Expand Up @@ -1650,8 +1658,8 @@ void MappingZones::paint(juce::Graphics &g)
g.setColour(selZoneColor);
g.drawRect(r, 2.f);

g.setColour(editor->themeColor(theme::ColorMap::generic_content_highest));
g.setFont(editor->themeApplier.interMediumFor(12));
g.setColour(editor->themeColor(theme::ColorMap::generic_content_high));
g.setFont(editor->themeApplier.interRegularFor(11));
g.drawText(std::get<2>(z.second), r.reduced(5, 3), juce::Justification::topLeft);

auto ct = display->voiceCountFor(z.first);
Expand Down
11 changes: 8 additions & 3 deletions src-ui/components/multi/detail/GroupZoneTreeControl.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,16 @@ template <typename SidebarParent, bool fz> struct GroupZoneListBoxModel : juce::

bool isLeadZone = isZone() && gsb->isLeadZone(sg.first);

auto editor = gsb->partGroupSidebar->editor;

auto st = gsb->partGroupSidebar->style();
g.setFont(st->getFont(jcmp::Label::Styles::styleClass, jcmp::Label::Styles::labelfont));
auto zoneFont = editor->themeApplier.interLightFor(11);
auto groupFont = editor->themeApplier.interRegularFor(11);

// TODO: Style all of these
auto editor = gsb->partGroupSidebar->editor;
if (isZone())
g.setFont(zoneFont);
else
g.setFont(groupFont);

auto borderColor = editor->themeColor(theme::ColorMap::accent_1b, 0.4);
auto textColor = editor->themeColor(theme::ColorMap::generic_content_medium);
Expand Down
20 changes: 20 additions & 0 deletions src-ui/theme/ThemeApplier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,13 +245,33 @@ void ThemeApplier::applyHeaderSCButtonTheme(sst::jucegui::style::StyleConsumer *
s->setCustomClass(detail::header::GlyphButtonAccent);
}

juce::Font ThemeApplier::interBoldFor(int ht) const
{
static auto interMed = connectors::resources::loadTypeface("fonts/Inter/static/Inter-Bold.ttf");
return juce::Font(interMed).withHeight(ht);
}

juce::Font ThemeApplier::interMediumFor(int ht) const
{
static auto interMed =
connectors::resources::loadTypeface("fonts/Inter/static/Inter-Medium.ttf");
return juce::Font(interMed).withHeight(ht);
}

juce::Font ThemeApplier::interRegularFor(int ht) const
{
static auto interMed =
connectors::resources::loadTypeface("fonts/Inter/static/Inter-Regular.ttf");
return juce::Font(interMed).withHeight(ht);
}

juce::Font ThemeApplier::interLightFor(int ht) const
{
static auto interMed =
connectors::resources::loadTypeface("fonts/Inter/static/Inter-Light.ttf");
return juce::Font(interMed).withHeight(ht);
}

namespace detail
{
namespace global
Expand Down
3 changes: 3 additions & 0 deletions src-ui/theme/ThemeApplier.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ struct ThemeApplier
// Some utilities to move single items
void setLabelToHighlight(sst::jucegui::style::StyleConsumer *);

juce::Font interBoldFor(int ht) const;
juce::Font interMediumFor(int ht) const;
juce::Font interRegularFor(int ht) const;
juce::Font interLightFor(int ht) const;

friend scxt::ui::SCXTEditor;

Expand Down

0 comments on commit 7cfd3c6

Please sign in to comment.