commit 8cf6b347382622164d8f4e2ca148d11bf56e19cb
Author: Juergen Spitzmueller <[email protected]>
Date:   Tue Jan 19 09:22:07 2021 +0100

    Update color table in branch list
---
 src/BranchList.cpp   |   10 ++++++++++
 src/BufferParams.cpp |   12 +-----------
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/BranchList.cpp b/src/BranchList.cpp
index 379b338..aa8551e 100644
--- a/src/BranchList.cpp
+++ b/src/BranchList.cpp
@@ -81,6 +81,16 @@ string const & Branch::color() const
 void Branch::setColor(string const & str)
 {
        color_ = str;
+
+       // Update the Color table
+       string color = str;
+       bool darkmode = theApp() ? theApp()->isInDarkMode() : false;
+       if (color == "none")
+               color = lcolor.getX11HexName(Color_background, darkmode);
+       else if (color.size() != 7 || color[0] != '#')
+               color = lcolor.getX11HexName(lcolor.getFromLyXName(color), 
darkmode);
+       // FIXME UNICODE
+       lcolor.setColor(to_utf8(branch_), color);
 }
 
 
diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp
index 93a5398..2c9821c 100644
--- a/src/BufferParams.cpp
+++ b/src/BufferParams.cpp
@@ -991,18 +991,8 @@ string BufferParams::readToken(Lexer & lex, string const & 
token,
                        if (tok == "\\color") {
                                lex.eatLine();
                                string color = lex.getString();
-                               if (branch_ptr) {
+                               if (branch_ptr)
                                        branch_ptr->setColor(color);
-                                       if (branch_ptr->color() == "none")
-                                               color = 
lcolor.getX11HexName(Color_background);
-                               }
-                               // Update also the Color table:
-                               if (color == "none")
-                                       color = 
lcolor.getX11HexName(Color_background);
-                               else if (color.size() != 7 || color[0] != '#')
-                                       color = lcolor.getFromLyXName(color);
-                               // FIXME UNICODE
-                               lcolor.setColor(to_utf8(branch), color);
                        }
                }
        } else if (token == "\\index") {
-- 
lyx-cvs mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to