260808.4.1 · 5ba030cac3c000feb2351ae65bb181ae3a294c1d
https://gitlab.com/saalen/highlight/-/work_items/224 added AnsiIndex theme attribute
Themes had no effect with --out-format=ansi, which emitted one hard coded sequence per element. A theme element may now carry AnsiIndex, a terminal palette index from 0 to 15, which is used for that element instead.
Elements without the attribute keep their previous sequence, so every shipped theme renders unchanged in this format. themes/terminal.theme shows the attribute in use.
reading declarations
Changes to src/include/elementstyle.h. All files
@@ -68,6 +68,7 @@ public: underline = other.isUnderline(); customOverride = other.getCustomOverride(); customAttribute = other.getCustomAttribute();+ ansiIndex = other.getAnsiIndex(); } /** operator overloading */@@ -79,6 +80,7 @@ public: underline = other.isUnderline(); customOverride = other.getCustomOverride(); customAttribute = other.getCustomAttribute();+ ansiIndex = other.getAnsiIndex(); return *this; }@@ -135,10 +137,17 @@ public: void setCustomOverride(bool override); + /** \return terminal colour index (0-15), or -1 if the element defines none */+ int getAnsiIndex() const;++ /** \param idx terminal colour index (0-15), or -1 to use the built-in default */+ void setAnsiIndex(int idx);+ private: Colour colour; bool bold, italic, underline, customOverride; std::string customAttribute;+ int ansiIndex{-1}; }; }