1
0
Fork 0
mirror of https://github.com/polybar/polybar.git synced 2024-11-11 13:50:56 -05:00
polybar/include/x11/color.hpp

42 lines
753 B
C++
Raw Normal View History

2016-11-02 15:22:45 -04:00
#pragma once
#include <map>
2016-11-02 15:22:45 -04:00
#include <X11/Xft/Xft.h>
2016-12-26 22:58:41 -05:00
#include <unordered_map>
2016-11-02 15:22:45 -04:00
#include "common.hpp"
#include "utils/color.hpp"
2016-12-26 22:58:41 -05:00
#include "utils/concurrency.hpp"
2016-11-02 15:22:45 -04:00
2016-11-19 00:22:44 -05:00
POLYBAR_NS
2016-11-02 15:22:45 -04:00
class color {
public:
explicit color(string hex);
string source() const;
operator XRenderColor() const;
operator string() const;
2016-12-26 03:40:15 -05:00
explicit operator uint32_t();
2016-11-02 15:22:45 -04:00
operator uint32_t() const;
2016-12-26 03:40:15 -05:00
static const color& parse(string input, const color& fallback);
static const color& parse(string input);
2016-11-02 15:22:45 -04:00
protected:
2016-11-04 13:54:33 -04:00
uint32_t m_value;
2016-11-02 15:22:45 -04:00
uint32_t m_color;
string m_source;
};
2016-12-26 22:58:41 -05: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 15:22:45 -04:00
2016-11-19 00:22:44 -05:00
POLYBAR_NS_END