Przeglądaj źródła

style: Enable Bold keywords and Italic comments in Everforest theme

Bernardo Magri 1 miesiąc temu
rodzic
commit
e47bce5c82
2 zmienionych plików z 21 dodań i 6 usunięć
  1. 8 4
      include/lumacs/face.hpp
  2. 13 2
      src/theme.cpp

+ 8 - 4
include/lumacs/face.hpp

@@ -23,10 +23,14 @@ enum class FontSlant {
 };
 
 struct FaceAttributes {
-    std::optional<std::string> family;
-    std::optional<int> height; // For GUI: 1/10 pt or px. For TUI: ignored.
-    std::optional<FontWeight> weight;
-    std::optional<FontSlant> slant;
+    // GUI-specific attributes (ignored in standard TUI/Ncurses)
+    std::optional<std::string> family; // e.g., "Fira Code", "Arial"
+    std::optional<int> height;         // 1/10 pt. e.g., 120 = 12pt
+
+    // Universal attributes (Supported in TUI via Bold/Italic flags)
+    std::optional<FontWeight> weight;  // Normal vs Bold
+    std::optional<FontSlant> slant;    // Normal vs Italic
+    
     std::optional<Color> foreground;
     std::optional<Color> background;
     std::optional<bool> underline;

+ 13 - 2
src/theme.cpp

@@ -264,14 +264,25 @@ std::shared_ptr<Theme> ThemeManager::create_everforest_theme() {
     
     // Text elements via set_color (which now sets faces)
     theme->set_color(ThemeElement::Normal, fg, bg0);
-    theme->set_color(ThemeElement::Keyword, red, bg0);
     theme->set_color(ThemeElement::String, green, bg0);
-    theme->set_color(ThemeElement::Comment, grey, bg0);
     theme->set_color(ThemeElement::Function, blue, bg0);
     theme->set_color(ThemeElement::Type, yellow, bg0);
     theme->set_color(ThemeElement::Number, purple, bg0);
     theme->set_color(ThemeElement::Constant, orange, bg0);
     theme->set_color(ThemeElement::Error, Color(255, 255, 255), red);
+
+    // Demonstrate rich faces (Bold/Italic)
+    FaceAttributes keyword_attrs;
+    keyword_attrs.foreground = red;
+    keyword_attrs.background = bg0;
+    keyword_attrs.weight = FontWeight::Bold;
+    theme->set_face("font-lock-keyword-face", keyword_attrs);
+
+    FaceAttributes comment_attrs;
+    comment_attrs.foreground = grey;
+    comment_attrs.background = bg0;
+    comment_attrs.slant = FontSlant::Italic;
+    theme->set_face("font-lock-comment-face", comment_attrs);
     
     // UI elements
     theme->set_color(ThemeElement::StatusLine, bg0, fg);