polybar/include/x11/color.hpp

42 lines
753 B
C++
Raw Normal View History

2016-11-02 19:22:45 +00:00
#pragma once
#include <map>
2016-11-02 19:22:45 +00:00
#include <X11/Xft/Xft.h>
2016-12-27 03:58:41 +00:00
#include <unordered_map>
2016-11-02 19:22:45 +00:00
#include "common.hpp"
#include "utils/color.hpp"
2016-12-27 03:58:41 +00:00
#include "utils/concurrency.hpp"
2016-11-02 19:22:45 +00:00
2016-11-19 05:22:44 +00:00
POLYBAR_NS
2016-11-02 19:22:45 +00:00
class color {
public:
explicit color(string hex);
string source() const;
operator XRenderColor() const;
operator string() const;
2016-12-26 08:40:15 +00:00
explicit operator uint32_t();
2016-11-02 19:22:45 +00:00
operator uint32_t() const;
2016-12-26 08:40:15 +00:00
static const color& parse(string input, const color& fallback);
static const color& parse(string input);
2016-11-02 19:22:45 +00:00
protected:
2016-11-04 17:54:33 +00:00
uint32_t m_value;
2016-11-02 19:22:45 +00:00
uint32_t m_color;
string m_source;
};
2016-12-27 03:58:41 +00:00
extern mutex_wrapper<std::unordered_map<string, color>> g_colorstore;
extern const color& g_colorempty;
extern const color& g_colorblack;
extern const color& g_colorwhite;
2016-11-02 19:22:45 +00:00
2016-11-19 05:22:44 +00:00
POLYBAR_NS_END