Skip to content

Commit

Permalink
Emit cellcolor and/or textcolor in X(HT)ML export
Browse files Browse the repository at this point in the history
When `cellcolor` or `textcolor` in a cell differs
from the one of the parent cell, emit its value.

See #502
for more details.
  • Loading branch information
tobiolo committed Sep 8, 2023
1 parent 8d4073d commit bbeddfd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/cell.h
Original file line number Diff line number Diff line change
Expand Up @@ -237,12 +237,12 @@ struct Cell {
str.Prepend(wxString() << text.stylebits);
str.Prepend(L" stylebits=\"");
}
if (cellcolor != doc->Background()) {
if (cellcolor != (parent ? parent->cellcolor : doc->Background())) {
str.Prepend(L"\"");
str.Prepend(wxString() << cellcolor);
str.Prepend(L" colorbg=\"");
}
if (textcolor != 0x000000) {
if (textcolor != (parent ? parent->textcolor : 0x000000)) {
str.Prepend(L"\"");
str.Prepend(wxString() << textcolor);
str.Prepend(L" colorfg=\"");
Expand All @@ -260,9 +260,9 @@ struct Cell {
if (text.stylebits & STYLE_BOLD) style += L"font-weight: bold;";
if (text.stylebits & STYLE_ITALIC) style += L"font-style: italic;";
if (text.stylebits & STYLE_FIXED) style += L"font-family: monospace;";
if (cellcolor != doc->Background())
if (cellcolor != (parent ? parent->cellcolor : doc->Background()))
style += wxString::Format(L"background-color: #%06X;", SwapColor(cellcolor));
if (textcolor != 0x000000)
if (textcolor != (parent ? parent->textcolor : 0x000000))
style += wxString::Format(L"color: #%06X;", SwapColor(textcolor));
str.Prepend(L"<td style=\"" + style + L"\">");
str.Append(L' ', indent);
Expand Down

0 comments on commit bbeddfd

Please sign in to comment.