<table><tr><td style="">mikhailru added a comment.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D16839">View Revision</a></tr></table><br /><div><div><p><a href="https://phabricator.kde.org/p/asemke/" style="
border-color: #f1f7ff;
color: #19558d;
background-color: #f1f7ff;
border: 1px solid transparent;
border-radius: 3px;
font-weight: bold;
padding: 0 4px;">@asemke</a>, thanks for your explanation! I've done some research, and it looks like at least 3 issues exist:</p>
<p>(1) The first case is when theme == "". This is what happens when no theme has been configured via the settings dialog and labplot2rc does not contain "Theme" key in [Settings_Worksheet] group, or when labplot2rc does not exist (first run). In this case, CartesianPlot does not apply theme to children, including axes labels:</p>
<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">//in CartesianPlot::childAdded
if (!d->theme.isEmpty()) {
const auto* elem = dynamic_cast<const WorksheetElement*>(child);
if (elem) {
KConfig config(ThemeHandler::themeFilePath(d->theme), KConfig::SimpleConfig);
const_cast<WorksheetElement*>(elem)->loadThemeConfig(config);
}
} else {
//no theme is available, apply the default colors for curves only, s.a. XYCurve::loadThemeConfig()</pre></div>
<p>This results in d->textWrapper.text in TextLabels containing plain text without any formatting. I've checked XMLs to verify:</p>
<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);"><textLabel creation_time="2018-23-11 00:20:41:571" name="x axis 1">
<comment></comment>
<geometry x="-10.5833" y="605.444" horizontalPosition="3" verticalPosition="3" horizontalAlignment="1" verticalAlignment="1" rotationAngle="0" visible="1"/>
<text>x axis 1</text>
<format teXUsed="0" fontFamily="Computer Modern" fontSize="-1" fontPointSize="12" fontWeight="50" fontItalic="0" teXFontColor_r="0" teXFontColor_g="0" teXFontColor_b="0"/>
</textLabel></pre></div>
<p>Compare this to the XML obtained with theme != "":</p>
<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);"><textLabel creation_time="2018-23-11 00:31:30:976" name="x axis 1">
<comment />
<geometry x="-10.5833" y="605.444" horizontalPosition="3" verticalPosition="3" horizontalAlignment="1" verticalAlignment="1" rotationAngle="0" visible="1" />
<text>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'Noto Sans'; font-size:10pt; font-weight:400; font-style:normal;">
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#ffffff; background-color:#000000;">x axis 1</span></p></body></html>
</text>
<format teXUsed="0" fontFamily="Computer Modern" fontSize="-1" fontPointSize="12" fontWeight="50" fontItalic="0" teXFontColor_r="0" teXFontColor_g="0" teXFontColor_b="0" />
</textLabel></pre></div>
<p>This text without formatting is painted with the default color, taken from the Qt theme. And this is the case which my original patch addressed.</p>
<p>(2) theme == "None". I suppose it's what you were talking about in "On the last screenshot...". In this case theme != "", but ThemeHandler::themeFilePath cannot find theme file and returns "", so values hardcoded in KConfigGroup::readEntry calls are used. Unfortunately, both [Label]/FontColor (TextLabel.cpp:842) and [Worksheet]/BackgroundFirstColor (Worksheet.cpp:96) use Qt::white as default.</p>
<p>(3) LabelWidget doesn't look nice with some Qt theme/label colors combination.</p>
<p>What can be done about this? I'm not deeply familiar with the codebase, but I have some ideas. If you find them worthwhile, I'll submit patches.</p>
<p>(1) I'm not sure whether using labels text without formatting is a supposed mode of operation. Maybe we should somehow fallback to "None" (hardcoded) theme instead of current behaviour?</p>
<p>(2) Swap background/foreground color defaults in TextLabel::loadThemeConfig. This one looks harmless.</p>
<p>(3) Concerning this one, I can't come up with a solution which doesn't hurt present functionality. I'll think a bit more. Btw, does [Label]/BackgroundColor affect plot appearance in any way?</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R262 LabPlot</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D16839">https://phabricator.kde.org/D16839</a></div></div><br /><div><strong>To: </strong>mikhailru, LabPlot<br /><strong>Cc: </strong>asemke, cfeck, kde-edu, narvaez, apol<br /></div>