diff --git a/Widgets/Button.cpp b/Widgets/Button.cpp index 6862c93fe4e..f309d3f4658 100644 --- a/Widgets/Button.cpp +++ b/Widgets/Button.cpp @@ -21,22 +21,21 @@ void Button::setCaption(String&& caption) void Button::onPaint(PaintEvent&) { - Color buttonColor(192, 192, 192); - Color highlightColor(255, 255, 255); - Color shadowColor(96, 96, 96); + Color buttonColor = Color::LightGray; + Color highlightColor = Color::White; + Color shadowColor = Color(96, 96, 96); Painter painter(*this); - painter.fillRect(rect(), Color(255, 0, 255)); painter.drawPixel({ 0, 0 }, backgroundColor()); painter.drawPixel({ width() - 1, 0 }, backgroundColor()); painter.drawPixel({ 0, height() - 1 }, backgroundColor()); painter.drawPixel({ width() - 1, height() - 1 }, backgroundColor()); - painter.drawLine({ 1, 0 }, { width() - 2, 0 }, Color(0, 0, 0)); - painter.drawLine({ 1, height() - 1 }, { width() - 2, height() - 1}, Color(0, 0, 0)); - painter.drawLine({ 0, 1 }, { 0, height() - 2 }, Color(0, 0, 0)); - painter.drawLine({ width() - 1, 1 }, { width() - 1, height() - 2 }, Color(0, 0, 0)); + painter.drawLine({ 1, 0 }, { width() - 2, 0 }, Color::Black); + painter.drawLine({ 1, height() - 1 }, { width() - 2, height() - 1}, Color::Black); + painter.drawLine({ 0, 1 }, { 0, height() - 2 }, Color::Black); + painter.drawLine({ width() - 1, 1 }, { width() - 1, height() - 2 }, Color::Black); if (m_beingPressed) { // Base @@ -66,7 +65,7 @@ void Button::onPaint(PaintEvent&) auto textRect = rect(); if (m_beingPressed) textRect.moveBy(1, 1); - painter.drawText(textRect, caption(), Painter::TextAlignment::Center, Color(0, 0, 0)); + painter.drawText(textRect, caption(), Painter::TextAlignment::Center, Color::Black); } } diff --git a/Widgets/CheckBox.cpp b/Widgets/CheckBox.cpp index 5391a0177fe..ff2fff1c1b7 100644 --- a/Widgets/CheckBox.cpp +++ b/Widgets/CheckBox.cpp @@ -88,10 +88,10 @@ void CheckBox::onPaint(PaintEvent&) bitmapPosition.setY(height() / 2 - bitmap->height() / 2 - 1); painter.fillRect(rect(), backgroundColor()); - painter.drawBitmap(bitmapPosition, *bitmap, Color(0, 0, 0)); + painter.drawBitmap(bitmapPosition, *bitmap, foregroundColor()); if (!caption().isEmpty()) { - painter.drawText(textRect, caption(), Painter::TextAlignment::TopLeft, Color(0, 0, 0)); + painter.drawText(textRect, caption(), Painter::TextAlignment::TopLeft, foregroundColor()); } } diff --git a/Widgets/ClockWidget.cpp b/Widgets/ClockWidget.cpp index a0e2aadcaa0..950c450504c 100644 --- a/Widgets/ClockWidget.cpp +++ b/Widgets/ClockWidget.cpp @@ -22,8 +22,8 @@ void ClockWidget::onPaint(PaintEvent&) sprintf(timeBuf, "%02u:%02u:%02u ", tm.tm_hour, tm.tm_min, tm.tm_sec); Painter painter(*this); - painter.fillRect(rect(), Color(127, 127, 127)); - painter.drawText(rect(), timeBuf, Painter::TextAlignment::Center, Color(0,0,0)); + painter.fillRect(rect(), Color::MidGray); + painter.drawText(rect(), timeBuf, Painter::TextAlignment::Center, Color::Black); } void ClockWidget::onTimer(TimerEvent&) diff --git a/Widgets/Color.h b/Widgets/Color.h index 9a18e78ed48..28abafc2e85 100644 --- a/Widgets/Color.h +++ b/Widgets/Color.h @@ -10,6 +10,9 @@ public: Red, Green, Blue, + DarkGray, + MidGray, + LightGray, }; Color() { } diff --git a/Widgets/ColorSDL.cpp b/Widgets/ColorSDL.cpp index 50228fb8fc4..45c7ff5f772 100644 --- a/Widgets/ColorSDL.cpp +++ b/Widgets/ColorSDL.cpp @@ -20,6 +20,9 @@ Color::Color(NamedColor named) case Red: rgb = { 255, 0, 0}; break; case Green: rgb = { 0, 255, 0}; break; case Blue: rgb = { 0, 0, 255}; break; + case DarkGray: rgb = { 64, 64, 64 }; break; + case MidGray: rgb = { 127, 127, 127 }; break; + case LightGray: rgb = { 192, 192, 192 }; break; default: ASSERT_NOT_REACHED(); break; } diff --git a/Widgets/RootWidget.cpp b/Widgets/RootWidget.cpp index 79666c110bf..4cd0cc8db5f 100644 --- a/Widgets/RootWidget.cpp +++ b/Widgets/RootWidget.cpp @@ -21,7 +21,7 @@ void RootWidget::onPaint(PaintEvent& event) event.rect().width(), event.rect().height()); Painter painter(*this); - painter.fillRect(event.rect(), Color(0x40, 0x40, 0x40)); + painter.fillRect(event.rect(), Color(0, 72, 96)); } void RootWidget::onMouseMove(MouseEvent& event) diff --git a/Widgets/TerminalWidget.cpp b/Widgets/TerminalWidget.cpp index 16c62e43cff..8bc8bd815c1 100644 --- a/Widgets/TerminalWidget.cpp +++ b/Widgets/TerminalWidget.cpp @@ -63,7 +63,7 @@ CharacterWithAttributes& TerminalWidget::at(unsigned row, unsigned column) void TerminalWidget::onPaint(PaintEvent&) { Painter painter(*this); - painter.fillRect(rect(), Color(0, 0, 0)); + painter.fillRect(rect(), Color::Black); auto& font = Font::defaultFont(); diff --git a/Widgets/Widget.cpp b/Widgets/Widget.cpp index a742ba64616..e96f9690295 100644 --- a/Widgets/Widget.cpp +++ b/Widgets/Widget.cpp @@ -8,8 +8,8 @@ Widget::Widget(Widget* parent) : Object(parent) { - m_backgroundColor = Color(255, 255, 255); - m_foregroundColor = Color(0, 0, 0); + m_backgroundColor = Color::White; + m_foregroundColor = Color::Black; } Widget::~Widget() diff --git a/Widgets/WindowManager.cpp b/Widgets/WindowManager.cpp index 15104a933ed..df0a695f838 100644 --- a/Widgets/WindowManager.cpp +++ b/Widgets/WindowManager.cpp @@ -46,8 +46,8 @@ WindowManager& WindowManager::the() WindowManager::WindowManager() { - m_windowBorderColor = Color(0x00, 0x00, 0x80); - m_windowTitleColor = Color(0xff, 0xff, 0xff); + m_windowBorderColor = Color(0, 64, 192); + m_windowTitleColor = Color::White; } WindowManager::~WindowManager() @@ -92,17 +92,17 @@ void WindowManager::paintWindowFrame(Window& window) if (!m_lastDragRect.isEmpty()) { - p.xorRect(m_lastDragRect, Color(255, 0, 0)); + p.xorRect(m_lastDragRect, Color::Red); m_lastDragRect = Rect(); } if (m_dragWindow == &window) { - p.xorRect(outerRect, Color(255, 0, 0)); + p.xorRect(outerRect, Color::Red); m_lastDragRect = outerRect; return; } - p.drawRect(borderRect, Color(255, 255, 255)); + p.drawRect(borderRect, Color::White); p.drawRect(outerRect, m_windowBorderColor); p.fillRect(titleBarRect, m_windowBorderColor);