2016-10-31 00:21:24 +00:00
|
|
|
#pragma once
|
|
|
|
|
2017-01-24 11:37:19 +00:00
|
|
|
#include <cstdlib>
|
|
|
|
|
2016-10-31 00:21:24 +00:00
|
|
|
#include "common.hpp"
|
|
|
|
|
2016-11-19 05:22:44 +00:00
|
|
|
POLYBAR_NS
|
2016-10-31 00:21:24 +00:00
|
|
|
|
2019-10-27 21:06:25 +00:00
|
|
|
struct rgba {
|
|
|
|
/**
|
|
|
|
* Color value in the form ARGB or A000 depending on the type
|
|
|
|
*/
|
|
|
|
uint32_t m_value;
|
2017-01-19 04:38:42 +00:00
|
|
|
|
2019-10-27 21:06:25 +00:00
|
|
|
enum color_type { NONE, ARGB, ALPHA_ONLY } m_type{NONE};
|
2017-01-19 04:38:42 +00:00
|
|
|
|
2019-10-27 21:06:25 +00:00
|
|
|
explicit rgba();
|
|
|
|
explicit rgba(uint32_t value, color_type type = ARGB);
|
|
|
|
explicit rgba(string hex);
|
|
|
|
|
|
|
|
operator string() const;
|
|
|
|
operator uint32_t() const;
|
|
|
|
bool operator==(const rgba& other) const;
|
|
|
|
|
|
|
|
double a() const;
|
|
|
|
double r() const;
|
|
|
|
double g() const;
|
|
|
|
double b() const;
|
|
|
|
|
|
|
|
uint8_t a_int() const;
|
|
|
|
uint8_t r_int() const;
|
|
|
|
uint8_t g_int() const;
|
|
|
|
uint8_t b_int() const;
|
|
|
|
|
|
|
|
bool has_color() const;
|
2017-01-19 04:38:42 +00:00
|
|
|
};
|
|
|
|
|
2019-10-27 21:06:25 +00:00
|
|
|
namespace color_util {
|
|
|
|
|
|
|
|
uint8_t alpha_channel(const uint32_t value);
|
|
|
|
uint8_t red_channel(const uint32_t value);
|
|
|
|
uint8_t green_channel(const uint32_t value);
|
|
|
|
uint8_t blue_channel(const uint32_t value);
|
|
|
|
|
|
|
|
string simplify_hex(string hex);
|
|
|
|
} // namespace color_util
|
|
|
|
|
2016-11-19 05:22:44 +00:00
|
|
|
POLYBAR_NS_END
|