Skip to content

Commit e490fc9

Browse files
xTiborawesomekling
authored andcommitted
FontEditor: Make the application theme-aware
1 parent 59b9e9c commit e490fc9

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

Applications/FontEditor/GlyphEditorWidget.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include "GlyphEditorWidget.h"
2828
#include <LibGUI/Painter.h>
2929
#include <LibGfx/Font.h>
30+
#include <LibGfx/Palette.h>
3031

3132
GlyphEditorWidget::GlyphEditorWidget(Gfx::Font& mutable_font, GUI::Widget* parent)
3233
: GUI::Frame(parent)
@@ -57,26 +58,26 @@ void GlyphEditorWidget::paint_event(GUI::PaintEvent& event)
5758
GUI::Painter painter(*this);
5859
painter.add_clip_rect(frame_inner_rect());
5960
painter.add_clip_rect(event.rect());
60-
painter.fill_rect(frame_inner_rect(), Color::White);
61+
painter.fill_rect(frame_inner_rect(), palette().base());
6162
painter.translate(frame_thickness(), frame_thickness());
6263

6364
painter.translate(-1, -1);
6465
for (int y = 1; y < font().glyph_height(); ++y)
65-
painter.draw_line({ 0, y * m_scale }, { font().max_glyph_width() * m_scale, y * m_scale }, Color::Black);
66+
painter.draw_line({ 0, y * m_scale }, { font().max_glyph_width() * m_scale, y * m_scale }, palette().threed_shadow2());
6667

6768
for (int x = 1; x < font().max_glyph_width(); ++x)
68-
painter.draw_line({ x * m_scale, 0 }, { x * m_scale, font().glyph_height() * m_scale }, Color::Black);
69+
painter.draw_line({ x * m_scale, 0 }, { x * m_scale, font().glyph_height() * m_scale }, palette().threed_shadow2());
6970

7071
auto bitmap = font().glyph_bitmap(m_glyph);
7172

7273
for (int y = 0; y < font().glyph_height(); ++y) {
7374
for (int x = 0; x < font().max_glyph_width(); ++x) {
7475
Gfx::Rect rect { x * m_scale, y * m_scale, m_scale, m_scale };
7576
if (x >= font().glyph_width(m_glyph)) {
76-
painter.fill_rect(rect, Color::MidGray);
77+
painter.fill_rect(rect, palette().threed_shadow1());
7778
} else {
7879
if (bitmap.bit_at(x, y))
79-
painter.fill_rect(rect, Color::Black);
80+
painter.fill_rect(rect, palette().base_text());
8081
}
8182
}
8283
}

Applications/FontEditor/GlyphMapWidget.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ void GlyphMapWidget::paint_event(GUI::PaintEvent& event)
8989
painter.add_clip_rect(event.rect());
9090

9191
painter.set_font(font());
92-
painter.fill_rect(frame_inner_rect(), Color::White);
92+
painter.fill_rect(frame_inner_rect(), palette().base());
9393

9494
u8 glyph = 0;
9595

@@ -103,9 +103,9 @@ void GlyphMapWidget::paint_event(GUI::PaintEvent& event)
103103
font().glyph_height());
104104
if (glyph == m_selected_glyph) {
105105
painter.fill_rect(outer_rect, palette().selection());
106-
painter.draw_glyph(inner_rect.location(), glyph, Color::White);
106+
painter.draw_glyph(inner_rect.location(), glyph, palette().selection_text());
107107
} else {
108-
painter.draw_glyph(inner_rect.location(), glyph, Color::Black);
108+
painter.draw_glyph(inner_rect.location(), glyph, palette().base_text());
109109
}
110110
}
111111
}

0 commit comments

Comments
 (0)