summaryrefslogtreecommitdiffstats
path: root/src/styling.hh
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/styling.hh87
1 files changed, 22 insertions, 65 deletions
diff --git a/src/styling.hh b/src/styling.hh
index 001383a..b69418d 100644
--- a/src/styling.hh
+++ b/src/styling.hh
@@ -35,74 +35,13 @@
#include <utility>
#include <vector>
+#include "base/color_spaces.hh"
#include "base/intern_string.hh"
#include "base/result.h"
#include "log_level.hh"
#include "mapbox/variant.hpp"
#include "yajlpp/yajlpp.hh"
-
-struct rgb_color {
- static Result<rgb_color, std::string> from_str(const string_fragment& sf);
-
- explicit rgb_color(short r = -1, short g = -1, short b = -1)
- : rc_r(r), rc_g(g), rc_b(b)
- {
- }
-
- bool empty() const
- {
- return this->rc_r == -1 && this->rc_g == -1 && this->rc_b == -1;
- }
-
- bool operator==(const rgb_color& rhs) const;
-
- bool operator!=(const rgb_color& rhs) const;
-
- bool operator<(const rgb_color& rhs) const;
-
- bool operator>(const rgb_color& rhs) const;
-
- bool operator<=(const rgb_color& rhs) const;
-
- bool operator>=(const rgb_color& rhs) const;
-
- short rc_r;
- short rc_g;
- short rc_b;
-};
-
-struct lab_color {
- lab_color() : lc_l(0), lc_a(0), lc_b(0) {}
-
- explicit lab_color(const rgb_color& rgb);
-
- double deltaE(const lab_color& other) const;
-
- lab_color& operator=(const lab_color& other)
- {
- this->lc_l = other.lc_l;
- this->lc_a = other.lc_a;
- this->lc_b = other.lc_b;
-
- return *this;
- }
-
- bool operator==(const lab_color& rhs) const;
-
- bool operator!=(const lab_color& rhs) const;
-
- bool operator<(const lab_color& rhs) const;
-
- bool operator>(const lab_color& rhs) const;
-
- bool operator<=(const lab_color& rhs) const;
-
- bool operator>=(const lab_color& rhs) const;
-
- double lc_l;
- double lc_a;
- double lc_b;
-};
+#include "yajlpp/yajlpp_def.hh"
struct term_color {
short xc_id;
@@ -115,7 +54,7 @@ struct term_color {
struct term_color_palette {
term_color_palette(const char* name, const string_fragment& json);
- short match_color(const lab_color& to_match);
+ short match_color(const lab_color& to_match) const;
std::vector<term_color> tc_palette;
};
@@ -152,10 +91,16 @@ struct style_config {
std::string sc_background_color;
bool sc_underline{false};
bool sc_bold{false};
+
+ bool empty() const
+ {
+ return this->sc_color.empty() && this->sc_background_color.empty()
+ && !this->sc_underline && !this->sc_bold;
+ }
};
struct highlighter_config {
- std::string hc_regex;
+ factory_container<lnav::pcre2pp::code> hc_regex;
style_config hc_style;
};
@@ -174,9 +119,11 @@ struct lnav_theme {
positioned_property<style_config> lt_style_scrollbar;
positioned_property<style_config> lt_style_hidden;
positioned_property<style_config> lt_style_cursor_line;
+ positioned_property<style_config> lt_style_disabled_cursor_line;
positioned_property<style_config> lt_style_adjusted_time;
positioned_property<style_config> lt_style_skewed_time;
positioned_property<style_config> lt_style_offset_time;
+ positioned_property<style_config> lt_style_file_offset;
positioned_property<style_config> lt_style_invalid_msg;
positioned_property<style_config> lt_style_status_title;
positioned_property<style_config> lt_style_status_title_hotkey;
@@ -184,6 +131,7 @@ struct lnav_theme {
positioned_property<style_config> lt_style_status_subtitle;
positioned_property<style_config> lt_style_status_info;
positioned_property<style_config> lt_style_status_hotkey;
+ positioned_property<style_config> lt_style_inline_code;
positioned_property<style_config> lt_style_quoted_code;
positioned_property<style_config> lt_style_code_border;
positioned_property<style_config> lt_style_keyword;
@@ -192,7 +140,15 @@ struct lnav_theme {
positioned_property<style_config> lt_style_doc_directive;
positioned_property<style_config> lt_style_variable;
positioned_property<style_config> lt_style_symbol;
+ positioned_property<style_config> lt_style_null;
+ positioned_property<style_config> lt_style_ascii_ctrl;
+ positioned_property<style_config> lt_style_non_ascii;
positioned_property<style_config> lt_style_number;
+ positioned_property<style_config> lt_style_function;
+ positioned_property<style_config> lt_style_type;
+ positioned_property<style_config> lt_style_sep_ref_acc;
+ positioned_property<style_config> lt_style_suggestion;
+ positioned_property<style_config> lt_style_selected_text;
positioned_property<style_config> lt_style_re_special;
positioned_property<style_config> lt_style_re_repeat;
positioned_property<style_config> lt_style_diff_delete;
@@ -220,6 +176,7 @@ struct lnav_theme {
positioned_property<style_config> lt_style_footnote_border;
positioned_property<style_config> lt_style_footnote_text;
positioned_property<style_config> lt_style_snippet_border;
+ positioned_property<style_config> lt_style_indent_guide;
std::map<log_level_t, positioned_property<style_config>> lt_level_styles;
std::map<std::string, highlighter_config> lt_highlights;
};