[apps][escher] Improve colors

Change-Id: I31d3353a5372b63a6c2b3e62c88fb3b5c627e088
This commit is contained in:
Émilie Feral
2017-01-23 18:20:44 +01:00
parent d45000b3d9
commit 0704ab8776
12 changed files with 26 additions and 55 deletions

View File

@@ -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;
}

View File

@@ -5,9 +5,6 @@
#include <float.h>
#include <string.h>
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

View File

@@ -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;

View File

@@ -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);
}
}

View File

@@ -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;

View File

@@ -2,10 +2,6 @@
#include <assert.h>
#include <math.h>
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 {

View File

@@ -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;

View File

@@ -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;
};

View File

@@ -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;

View File

@@ -1,8 +1,5 @@
#include <escher/even_odd_cell.h>
constexpr KDColor EvenOddCell::k_evenLineBackgroundColor;
constexpr KDColor EvenOddCell::k_oddLineBackgroundColor;
constexpr KDColor EvenOddCell::k_selectedLineBackgroundColor;
#include <escher/palette.h>
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;
}

View File

@@ -1,9 +1,7 @@
#include <escher/header_view_controller.h>
#include <escher/palette.h>
#include <assert.h>
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;
}

View File

@@ -1,12 +1,9 @@
#include <escher/tab_view_cell.h>
#include <escher/palette.h>
extern "C" {
#include <assert.h>
}
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);