#pragma once #include #include #include #include #include #include "lumacs/color.hpp" #include "lumacs/face.hpp" namespace lumacs { /// Theme element types (Legacy / Semantic Names) enum class ThemeElement { // Text elements Normal, Keyword, String, Comment, Function, Type, Number, Constant, Error, // UI elements StatusLine, StatusLineInactive, MessageLine, LineNumber, Cursor, Selection, SearchMatch, SearchFail, // Window elements WindowBorder, WindowBorderActive, // Special Background }; /// A theme defines colors and attributes for various UI elements and named faces class Theme { public: Theme(const std::string& name) : name_(name) {} /// Set color for a theme element (Legacy) void set_color(ThemeElement element, const Color& fg, const Color& bg = Color(-1, -1, -1)); /// Set full face attributes void set_face(const std::string& name, const FaceAttributes& attrs); /// Get face attributes std::optional get_face(const std::string& name) const; /// Get foreground color for an element (Legacy) Color get_fg_color(ThemeElement element) const; /// Get background color for an element (Legacy) Color get_bg_color(ThemeElement element) const; /// Get ncurses color pair for an element (Legacy - resolves via faces now) int get_color_pair(ThemeElement element) const; /// Get ncurses color pair for a face int get_face_color_pair(const std::string& name) const; /// Get ncurses attributes (color pair + flags) for a face int get_face_attributes_ncurses(const std::string& name) const; /// Theme name const std::string& name() const { return name_; } /// Initialize all color pairs for ncurses void initialize_ncurses_colors(); /// Helper to convert ThemeElement to face name static std::string element_to_face_name(ThemeElement element); private: std::string name_; // std::map> colors_; // Legacy storage - removed std::map faces_; mutable std::map face_pairs_; // Cache for ncurses pairs mutable int next_pair_id_ = 1; // Helper for inheritance resolution std::optional get_face_recursive(const std::string& name, int depth) const; }; /// Theme manager - handles multiple themes and switching between them class ThemeManager { public: /// Register a new theme void register_theme(std::shared_ptr theme); /// Set the active theme void set_active_theme(const std::string& name); /// Get the active theme std::shared_ptr active_theme() const { return active_theme_; } /// Get available theme names std::vector theme_names() const; /// Create default themes void create_default_themes(); /// Create Everforest dark theme std::shared_ptr create_everforest_theme(); /// Create default light theme std::shared_ptr create_default_theme(); /// Create Dracula theme std::shared_ptr create_dracula_theme(); private: std::map> themes_; std::shared_ptr active_theme_; }; } // namespace lumacs