From c9efd09f712362839383b50ecf3628340118d82e Mon Sep 17 00:00:00 2001
From: patrick96
Date: Sun, 27 Oct 2019 22:41:18 +0100
Subject: [PATCH] Load rgba from config instead of strings.
---
include/components/builder.hpp | 17 ++---
include/components/types.hpp | 11 +--
include/drawtypes/label.hpp | 12 ++--
include/drawtypes/progressbar.hpp | 6 +-
include/modules/meta/base.hpp | 8 +--
include/modules/mpd.hpp | 4 +-
src/components/bar.cpp | 20 +++---
src/components/builder.cpp | 112 ++++++++++--------------------
src/components/config.cpp | 7 +-
src/drawtypes/label.cpp | 24 +++----
src/drawtypes/progressbar.cpp | 17 ++---
src/modules/meta/base.cpp | 38 +++++-----
src/modules/mpd.cpp | 23 +++---
13 files changed, 129 insertions(+), 170 deletions(-)
diff --git a/include/components/builder.hpp b/include/components/builder.hpp
index 30386057..4d39f62d 100644
--- a/include/components/builder.hpp
+++ b/include/components/builder.hpp
@@ -33,20 +33,19 @@ class builder {
void remove_trailing_space();
void font(int index);
void font_close();
- void background(string color);
+ void background(rgba color);
void background_close();
- void color(string color);
- void color_alpha(string alpha);
+ void color(rgba color);
void color_close();
- void line_color(const string& color);
+ void line_color(const rgba& color);
void line_color_close();
- void overline_color(string color);
+ void overline_color(rgba color);
void overline_color_close();
- void underline_color(string color);
+ void underline_color(rgba color);
void underline_color_close();
- void overline(const string& color = "");
+ void overline(const rgba& color = rgba{});
void overline_close();
- void underline(const string& color = "");
+ void underline(const rgba& color = rgba{});
void underline_close();
void control(controltag tag);
void action(mousebtn index, string action);
@@ -56,8 +55,6 @@ class builder {
void action_close();
protected:
- string background_hex();
- string foreground_hex();
void tag_open(syntaxtag tag, const string& value);
void tag_open(attribute attr);
diff --git a/include/components/types.hpp b/include/components/types.hpp
index 8125d4b6..c1baefa1 100644
--- a/include/components/types.hpp
+++ b/include/components/types.hpp
@@ -6,6 +6,7 @@
#include
#include "common.hpp"
+#include "utils/color.hpp"
POLYBAR_NS
@@ -106,12 +107,12 @@ struct radius {
};
struct border_settings {
- unsigned int color{0xFF000000};
+ rgba color{0xFF000000};
unsigned int size{0U};
};
struct line_settings {
- unsigned int color{0xFF000000};
+ rgba color{0xFF000000};
unsigned int size{0U};
};
@@ -154,9 +155,9 @@ struct bar_settings {
side_values module_margin{0U, 0U};
edge_values strut{0U, 0U, 0U, 0U};
- unsigned int background{0xFF000000};
- unsigned int foreground{0xFFFFFFFF};
- vector background_steps;
+ rgba background{0xFF000000};
+ rgba foreground{0xFFFFFFFF};
+ vector background_steps;
line_settings underline{};
line_settings overline{};
diff --git a/include/drawtypes/label.hpp b/include/drawtypes/label.hpp
index 86b2173f..144446ae 100644
--- a/include/drawtypes/label.hpp
+++ b/include/drawtypes/label.hpp
@@ -20,10 +20,10 @@ namespace drawtypes {
class label : public non_copyable_mixin