diff --git a/apps/calculation/history_view_cell.cpp b/apps/calculation/history_view_cell.cpp index ea60010df..c11777586 100644 --- a/apps/calculation/history_view_cell.cpp +++ b/apps/calculation/history_view_cell.cpp @@ -15,7 +15,7 @@ HistoryViewCell::HistoryViewCell() : } KDColor HistoryViewCell::backgroundColor() const { - KDColor background = m_even ? EvenOddCell::k_evenLineBackgroundColor : EvenOddCell::k_oddLineBackgroundColor; + KDColor background = m_even ? Palette::WallScreen : KDColorWhite; return background; } diff --git a/apps/curve_view.cpp b/apps/curve_view.cpp index 9c4245a92..9ac2d53ec 100644 --- a/apps/curve_view.cpp +++ b/apps/curve_view.cpp @@ -5,9 +5,6 @@ #include #include -constexpr KDColor CurveView::k_axisColor; -constexpr KDColor CurveView::k_gridColor; - CurveView::CurveView(CurveViewRange * curveViewRange, CurveViewCursor * curveViewCursor, BannerView * bannerView, View * cursorView) : View(), @@ -184,12 +181,12 @@ void CurveView::drawGridLines(KDContext * ctx, KDRect rect, Axis axis, float ste } void CurveView::drawGrid(KDContext * ctx, KDRect rect) const { - drawGridLines(ctx, rect, Axis::Horizontal, m_curveViewRange->xGridUnit(), k_gridColor); - drawGridLines(ctx, rect, Axis::Vertical, m_curveViewRange->yGridUnit(), k_gridColor); + drawGridLines(ctx, rect, Axis::Horizontal, m_curveViewRange->xGridUnit(), Palette::GreyWhite); + drawGridLines(ctx, rect, Axis::Vertical, m_curveViewRange->yGridUnit(), Palette::GreyWhite); } void CurveView::drawAxes(KDContext * ctx, KDRect rect, Axis axis) const { - drawLine(ctx, rect, axis, 0.0f, k_axisColor, 2); + drawLine(ctx, rect, axis, 0.0f, KDColorBlack, 2); } #define LINE_THICKNESS 3 diff --git a/apps/curve_view.h b/apps/curve_view.h index c6f499585..7d5d36f96 100644 --- a/apps/curve_view.h +++ b/apps/curve_view.h @@ -25,8 +25,6 @@ public: protected: void setCurveViewRange(CurveViewRange * curveViewRange); // Drawing methods - constexpr static KDColor k_axisColor = KDColor::RGB24(0x000000); - constexpr static KDColor k_gridColor = KDColor::RGB24(0xEEEEEE); constexpr static KDCoordinate k_labelMargin = 4; constexpr static int k_maxNumberOfXLabels = CurveViewRange::k_maxNumberOfXGridUnits; constexpr static int k_maxNumberOfYLabels = CurveViewRange::k_maxNumberOfYGridUnits; diff --git a/apps/graph/list/function_expression_view.cpp b/apps/graph/list/function_expression_view.cpp index 3dca2d18c..6343c6265 100644 --- a/apps/graph/list/function_expression_view.cpp +++ b/apps/graph/list/function_expression_view.cpp @@ -3,8 +3,6 @@ namespace Graph { -constexpr KDColor FunctionExpressionView::k_separatorColor; - FunctionExpressionView::FunctionExpressionView() : EvenOddCell(), m_function(nullptr), @@ -48,7 +46,7 @@ void FunctionExpressionView::layoutSubviews() { void FunctionExpressionView::drawRect(KDContext * ctx, KDRect rect) const { EvenOddCell::drawRect(ctx, rect); // Color the separator - ctx->fillRect(KDRect(0, 0, k_separatorThickness, bounds().height()), k_separatorColor); + ctx->fillRect(KDRect(0, 0, k_separatorThickness, bounds().height()), Palette::GreyBright); } } diff --git a/apps/graph/list/function_expression_view.h b/apps/graph/list/function_expression_view.h index 229d8d404..449515d99 100644 --- a/apps/graph/list/function_expression_view.h +++ b/apps/graph/list/function_expression_view.h @@ -20,7 +20,6 @@ public: void drawRect(KDContext * ctx, KDRect rect) const override; private: static constexpr KDCoordinate k_emptyRowHeight = 50; - constexpr static KDColor k_separatorColor = KDColor::RGB24(0xEFF2F4); constexpr static KDCoordinate k_separatorThickness = 1; Function * m_function; ExpressionView m_expressionView; diff --git a/apps/zoom_parameter_controller.cpp b/apps/zoom_parameter_controller.cpp index b595203d2..481a6158d 100644 --- a/apps/zoom_parameter_controller.cpp +++ b/apps/zoom_parameter_controller.cpp @@ -2,10 +2,6 @@ #include #include -constexpr KDColor ZoomParameterController::ContentView::LegendView::k_legendBackgroundColor; - -/* Zoom Parameter Controller */ - ZoomParameterController::ZoomParameterController(Responder * parentResponder, InteractiveCurveViewRange * interactiveRange, CurveView * curveView) : ViewController(parentResponder), m_contentView(ContentView(curveView)), @@ -91,17 +87,17 @@ CurveView * ZoomParameterController::ContentView::curveView() { /* Legend View */ ZoomParameterController::ContentView::LegendView::LegendView() : - m_legends{PointerTextView(KDText::FontSize::Small, "ZOOM+", 0.0f, 0.5f, KDColorBlack, k_legendBackgroundColor), - PointerTextView(KDText::FontSize::Small, "HAUT", 0.0f, 0.5f, KDColorBlack, k_legendBackgroundColor), - PointerTextView(KDText::FontSize::Small, "GAUCHE", 0.0f, 0.5f, KDColorBlack, k_legendBackgroundColor), - PointerTextView(KDText::FontSize::Small, "ZOOM-", 1.0f, 0.5f, KDColorBlack, k_legendBackgroundColor), - PointerTextView(KDText::FontSize::Small, "BAS", 1.0f, 0.5f, KDColorBlack, k_legendBackgroundColor), - PointerTextView(KDText::FontSize::Small, "DROITE", 1.0f, 0.5f, KDColorBlack, k_legendBackgroundColor)} + m_legends{PointerTextView(KDText::FontSize::Small, "ZOOM+", 0.0f, 0.5f, KDColorBlack, Palette::GreyBright), + PointerTextView(KDText::FontSize::Small, "HAUT", 0.0f, 0.5f, KDColorBlack, Palette::GreyBright), + PointerTextView(KDText::FontSize::Small, "GAUCHE", 0.0f, 0.5f, KDColorBlack, Palette::GreyBright), + PointerTextView(KDText::FontSize::Small, "ZOOM-", 1.0f, 0.5f, KDColorBlack, Palette::GreyBright), + PointerTextView(KDText::FontSize::Small, "BAS", 1.0f, 0.5f, KDColorBlack, Palette::GreyBright), + PointerTextView(KDText::FontSize::Small, "DROITE", 1.0f, 0.5f, KDColorBlack, Palette::GreyBright)} { } void ZoomParameterController::ContentView::LegendView::drawRect(KDContext * ctx, KDRect rect) const { - ctx->fillRect(KDRect(0, bounds().height() - k_legendHeight, bounds().width(), k_legendHeight), k_legendBackgroundColor); + ctx->fillRect(KDRect(0, bounds().height() - k_legendHeight, bounds().width(), k_legendHeight), Palette::GreyBright); } int ZoomParameterController::ContentView::LegendView::numberOfSubviews() const { diff --git a/apps/zoom_parameter_controller.h b/apps/zoom_parameter_controller.h index 5b157e6e7..551e42258 100644 --- a/apps/zoom_parameter_controller.h +++ b/apps/zoom_parameter_controller.h @@ -24,7 +24,6 @@ private: LegendView(); void drawRect(KDContext * ctx, KDRect rect) const override; private: - constexpr static KDColor k_legendBackgroundColor = KDColor::RGB24(0xECECEC); constexpr static int k_numberOfLegends = 6; constexpr static KDCoordinate k_tokenWidth = 30; void layoutSubviews() override; diff --git a/escher/include/escher/even_odd_cell.h b/escher/include/escher/even_odd_cell.h index 5de9a8bbb..b49413631 100644 --- a/escher/include/escher/even_odd_cell.h +++ b/escher/include/escher/even_odd_cell.h @@ -9,11 +9,6 @@ public: virtual void setEven(bool even); virtual KDColor backgroundColor() const; void drawRect(KDContext * ctx, KDRect rect) const override; - - static constexpr KDColor k_evenLineBackgroundColor = KDColor::RGB24(0xF7F9FA); - static constexpr KDColor k_oddLineBackgroundColor = KDColorWhite; - static constexpr KDColor k_selectedLineBackgroundColor = KDColor::RGB24(0xC0D3EA); - protected: bool m_even; }; diff --git a/escher/include/escher/tab_view_cell.h b/escher/include/escher/tab_view_cell.h index c64659b16..67e7d2760 100644 --- a/escher/include/escher/tab_view_cell.h +++ b/escher/include/escher/tab_view_cell.h @@ -18,9 +18,6 @@ protected: void logAttributes(std::ostream &os) const override; #endif private: - constexpr static KDColor k_defaultTabColor = KDColor::RGB24(0x426DA7); - constexpr static KDColor k_selectedTabColor = KDColor::RGB24(0xC0D3EB); - constexpr static KDColor k_separatorTabColor = KDColor::RGB24(0x567AA7); bool m_active; bool m_selected; const char * m_name; diff --git a/escher/src/even_odd_cell.cpp b/escher/src/even_odd_cell.cpp index 166876cba..3f04a3c4b 100644 --- a/escher/src/even_odd_cell.cpp +++ b/escher/src/even_odd_cell.cpp @@ -1,8 +1,5 @@ #include - -constexpr KDColor EvenOddCell::k_evenLineBackgroundColor; -constexpr KDColor EvenOddCell::k_oddLineBackgroundColor; -constexpr KDColor EvenOddCell::k_selectedLineBackgroundColor; +#include EvenOddCell::EvenOddCell() : TableViewCell(), @@ -17,8 +14,8 @@ void EvenOddCell::setEven(bool even) { KDColor EvenOddCell::backgroundColor() const { // Select the background color according to the even line and the cursor selection - KDColor background = m_even ? EvenOddCell::k_evenLineBackgroundColor : EvenOddCell::k_oddLineBackgroundColor; - background = isHighlighted() ? EvenOddCell::k_selectedLineBackgroundColor : background; + KDColor background = m_even ? Palette::WallScreen : KDColorWhite; + background = isHighlighted() ? Palette::Select : background; return background; } diff --git a/escher/src/header_view_controller.cpp b/escher/src/header_view_controller.cpp index bb78530f2..02b6f2c39 100644 --- a/escher/src/header_view_controller.cpp +++ b/escher/src/header_view_controller.cpp @@ -1,9 +1,7 @@ #include +#include #include -constexpr KDColor HeaderViewController::ContentView::k_separatorHeaderColor; -constexpr KDColor HeaderViewController::ContentView::k_selectedBackgroundColor; - HeaderViewController::ContentView::ContentView(ViewController * mainViewController, HeaderViewDelegate * delegate) : View(), m_mainViewController(mainViewController), @@ -53,9 +51,9 @@ void HeaderViewController::ContentView::layoutSubviews() { void HeaderViewController::ContentView::drawRect(KDContext * ctx, KDRect rect) const { if (numberOfButtons() > 0) { ctx->fillRect(KDRect(0, 0, bounds().width(), k_headerHeight), KDColorWhite); - ctx->fillRect(KDRect(0, k_headerHeight, bounds().width(), 1), k_separatorHeaderColor); + ctx->fillRect(KDRect(0, k_headerHeight, bounds().width(), 1), Palette::GreyWhite); } else { - ctx->fillRect(KDRect(0, 0, bounds().width(), 1), k_separatorHeaderColor); + ctx->fillRect(KDRect(0, 0, bounds().width(), 1), Palette::GreyWhite); } } @@ -70,7 +68,7 @@ bool HeaderViewController::ContentView::setSelectedButton(int selectedButton, Ap m_selectedButton = selectedButton; if (m_selectedButton >= 0) { Button * button = buttonAtIndex(selectedButton); - button->setBackgroundColor(k_selectedBackgroundColor); + button->setBackgroundColor(Palette::Select); application->setFirstResponder(button); return true; } diff --git a/escher/src/tab_view_cell.cpp b/escher/src/tab_view_cell.cpp index 0a2d20cbb..7821d4c26 100644 --- a/escher/src/tab_view_cell.cpp +++ b/escher/src/tab_view_cell.cpp @@ -1,12 +1,9 @@ #include +#include extern "C" { #include } -constexpr KDColor TabViewCell::k_defaultTabColor; -constexpr KDColor TabViewCell::k_selectedTabColor; -constexpr KDColor TabViewCell::k_separatorTabColor; - TabViewCell::TabViewCell() : View(), m_active(false), @@ -38,15 +35,15 @@ void TabViewCell::drawRect(KDContext * ctx, KDRect rect) const { KDCoordinate height = bounds().height(); KDCoordinate width = bounds().width(); // choose the background color - KDColor text = m_active ? k_defaultTabColor : KDColorWhite; - KDColor background = m_active ? KDColorWhite : k_defaultTabColor; - background = m_selected ? k_selectedTabColor : background; + KDColor text = m_active ? Palette::PurpleBright : KDColorWhite; + KDColor background = m_active ? KDColorWhite : Palette::PurpleBright; + background = m_selected ? Palette::Select : background; // Color the background according to the state of the tab cell if (m_active || m_selected) { - ctx->fillRect(KDRect(0, 0, width, height), background); - } else { - ctx->fillRect(KDRect(0, 0, width, 1), k_separatorTabColor); + ctx->fillRect(KDRect(0, 0, width, 1), Palette::PurpleBright); ctx->fillRect(KDRect(0, 1, width, height-1), background); + } else { + ctx->fillRect(KDRect(0, 0, width, height), background); } // Write title KDSize textSize = KDText::stringSize(m_name, KDText::FontSize::Small);