[LyX/2.5.x] Handle empty table color values as "default" (#13306)

Juergen Spitzmueller <[email protected]> Thu, 30 Apr 2026 15:33:21 +0000
Newsgroups gmane.editors.lyx.cvs
Message-ID <[email protected]>
commit 1df911c66294870855fd6b5629601dba643a6d88
Author: Juergen Spitzmueller <[email protected]>
Date:   Thu Apr 30 09:18:21 2026 +0200

    Handle empty table color values as "default" (#13306)
    
    (cherry picked from commit 9b7dc5df8fda84ad2d6b29d5144627b76c307f1f)
---
 src/insets/InsetTabular.cpp | 9 +++++----
 status.25x                  | 3 +++
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp
index df0b5e0430..0560a48815 100644
--- a/src/insets/InsetTabular.cpp
+++ b/src/insets/InsetTabular.cpp
@@ -1644,7 +1644,7 @@ void Tabular::setCellColor(idx_type cell, std::string const & color)
 
 std::string Tabular::cellColor(idx_type cell) const
 {
-	return cellInfo(cell).color;
+	return cellInfo(cell).color.empty() ? "default" : cellInfo(cell).color;
 }
 
 void Tabular::setColumnColor(col_type column, std::string const & color)
@@ -1656,7 +1656,7 @@ void Tabular::setColumnColor(col_type column, std::string const & color)
 
 std::string Tabular::columnColor(col_type column) const
 {
-	return column_info[column].color;
+	return column_info[column].color.empty() ? "default" : column_info[column].color;
 }
 
 void Tabular::setRowColor(row_type row, std::string const & color)
@@ -1668,7 +1668,7 @@ void Tabular::setRowColor(row_type row, std::string const & color)
 
 std::string Tabular::rowColor(row_type r) const
 {
-	return row_info[r].color;
+	return row_info[r].color.empty() ? "default" : row_info[r].color;
 }
 
 
@@ -4758,7 +4758,8 @@ void Tabular::validate(LaTeXFeatures & features) const
 		if (columnColor(col) != "default")
 			used_colors.push_back(columnColor(col));
 	}
-	if (getOddRowColor() != "default" || getEvenRowColor() != "default") {
+	if ((!getOddRowColor().empty() && getOddRowColor() != "default")
+	    || (!getEvenRowColor().empty() && getEvenRowColor() != "default")) {
 		if (!features.isAvailableAtLeastFrom("colortbl", 2022, 6, 20)) {
 			// previous to this colortbl version, the feature
 			// was part of xcolor
diff --git a/status.25x b/status.25x
index cce09e600e..4213b6785f 100644
--- a/status.25x
+++ b/status.25x
@@ -53,6 +53,9 @@ What's new
 
 - Prevent duplicate theorem definitions (bug 13302).
 
+- Fix case where the colortbl package has been loaded unnecessarily
+  (bug 13306).
+
 
 * USER INTERFACE
 
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs