#ifndef CLRSYNC_CORE_PALETTE_PALETTE_HPP #define CLRSYNC_CORE_PALETTE_PALETTE_HPP #include #include #include "core/palette/color.hpp" #include "core/palette/color_keys.hpp" namespace clrsync::core { class palette { public: palette() = default; palette(const std::string &name) : m_name(name) { } const std::string &file_path() const { return m_file_path; } void set_file_path(const std::string &path) { m_file_path = path; } const std::string &name() const { return m_name; } const color &get_color(const std::string &key) const { auto it = m_colors.find(key); if (it != m_colors.end()) { return it->second; } auto default_it = DEFAULT_COLORS.find(key); if (default_it != DEFAULT_COLORS.end()) { static color default_color; default_color.set(default_it->second); return default_color; } static color empty_color{}; return empty_color; } const std::unordered_map &colors() const { return m_colors; } void set_name(const std::string &name) { m_name = name; } void set_color(const std::string &key, const color &col) { m_colors[key] = col; } private: std::string m_name{}; std::unordered_map m_colors{}; std::string m_file_path{}; }; } // namespace clrsync::core #endif