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

Juergen Spitzmueller <[email protected]> Thu, 30 Apr 2026 07:19:36 +0000
Newsgroups gmane.editors.lyx.cvs
Message-ID <[email protected]>
commit 9b7dc5df8fda84ad2d6b29d5144627b76c307f1f
Author: Juergen Spitzmueller <[email protected]>
Date:   Thu Apr 30 09:18:21 2026 +0200

    Handle empty table color values as "default" (#13306)
---
 src/insets/InsetTabular.cpp | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp
index d69257770f..bfba04baa7 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;
 }
 
 
@@ -4757,7 +4757,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
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs