[LyX/master] Introduce semantic label colors

Juergen Spitzmueller spitz at lyx.org
Fri Dec 11 10:17:15 UTC 2020


commit 91026711aed562d0343b4cda3e416a5decd1260c
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Fri Dec 11 11:44:45 2020 +0100

    Introduce semantic label colors
    
    This allows customization e.g. in dark mode and is a prerequisite
    for color theming
    
    Part of #8325
---
 lib/scripts/layout2layout.py |    7 +++++--
 src/Color.cpp                |    3 +++
 src/ColorCode.h              |    7 +++++++
 src/TextClass.cpp            |    2 +-
 4 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/lib/scripts/layout2layout.py b/lib/scripts/layout2layout.py
index 0a1edde..cc20a35 100644
--- a/lib/scripts/layout2layout.py
+++ b/lib/scripts/layout2layout.py
@@ -11,7 +11,7 @@
 # This script will update a .layout file to current format
 
 # The latest layout format is also defined in src/TextClass.cpp
-currentFormat = 89
+currentFormat = 90
 
 
 # Incremented to format 4, 6 April 2007, lasgouttes
@@ -304,6 +304,9 @@ currentFormat = 89
 # Incremented to format 89, 5 December 2020 by rkh
 # New tag LaTeXName for counters
 
+# Incremented to format 90, 11 December 2020 by spitz
+# Use semantic label colors
+
 # Do not forget to document format change in Customization
 # Manual (section "Declaring a new text class").
 
@@ -554,7 +557,7 @@ def convert(lines, end_format):
                 i += 1
             continue
 
-        if 87 <= format <= 89:
+        if 87 <= format <= 90:
             # nothing to do.
             i += 1
             continue
diff --git a/src/Color.cpp b/src/Color.cpp
index 6c5260f..e68b8b4 100644
--- a/src/Color.cpp
+++ b/src/Color.cpp
@@ -254,6 +254,9 @@ ColorSet::ColorSet()
 	{ Color_selection, N_("selection"), "selection", "#add8e6", "selection" },
 	{ Color_selectiontext, N_("selected text"), "selectiontext", black, "selectiontext" },
 	{ Color_latex, N_("LaTeX text"), "latex", DarkRed, "latex" },
+	{ Color_textlabel1, N_("Text label 1"), "textlabel1", blue, "textlabel1" },
+	{ Color_textlabel2, N_("Text label 2"), "textlabel2", Green, "textlabel2" },
+	{ Color_textlabel3, N_("Text label 3"), "textlabel3", magenta, "textlabel3" },
 	{ Color_inlinecompletion, N_("inline completion"),
 		"inlinecompletion", grey60, "inlinecompletion" },
 	{ Color_nonunique_inlinecompletion, N_("non-unique inline completion"),
diff --git a/src/ColorCode.h b/src/ColorCode.h
index 24d4342..9badae9 100644
--- a/src/ColorCode.h
+++ b/src/ColorCode.h
@@ -108,6 +108,13 @@ enum ColorCode {
 	/// Label color for URL insets
 	Color_urllabel,
 
+	/// Label color 1 for text (layout) labels
+	Color_textlabel1,
+	/// Label color 2 for text (layout) labels
+	Color_textlabel2,
+	/// Label color 3 for text (layout) labels
+	Color_textlabel3,
+
 	/// Color for URL inset text
 	Color_urltext,
 
diff --git a/src/TextClass.cpp b/src/TextClass.cpp
index 5b69be6..9a8db85 100644
--- a/src/TextClass.cpp
+++ b/src/TextClass.cpp
@@ -59,7 +59,7 @@ namespace lyx {
 // You should also run the development/tools/updatelayouts.py script,
 // to update the format of all of our layout files.
 //
-int const LAYOUT_FORMAT = 89; // rkh: LaTeXName for counters
+int const LAYOUT_FORMAT = 90; // spitz: semantic label colors
 
 
 // Layout format for the current lyx file format. Controls which format is


More information about the lyx-cvs mailing list