diff --git a/src/plugins/texteditor/fontsettings.cpp b/src/plugins/texteditor/fontsettings.cpp index b1db84be748..e1ebc812ee3 100644 --- a/src/plugins/texteditor/fontsettings.cpp +++ b/src/plugins/texteditor/fontsettings.cpp @@ -229,17 +229,21 @@ void FontSettings::addMixinStyle(QTextCharFormat &textCharFormat, const Format &format = m_scheme.formatFor(mixinStyle); if (textCharFormat.hasProperty(QTextFormat::ForegroundBrush)) { - textCharFormat.setForeground(mixBrush(textCharFormat.foreground(), - format.relativeForegroundSaturation(), - format.relativeForegroundLightness())); + if (format.foreground().isValid()) + textCharFormat.setForeground(format.foreground()); + else + textCharFormat.setForeground(mixBrush(textCharFormat.foreground(), + format.relativeForegroundSaturation(), + format.relativeForegroundLightness())); } - if (textCharFormat.hasProperty(QTextFormat::BackgroundBrush)) { - textCharFormat.setBackground(mixBrush(textCharFormat.background(), - format.relativeBackgroundSaturation(), - format.relativeBackgroundLightness())); + if (format.background().isValid()) + textCharFormat.setBackground(format.background()); + else + textCharFormat.setBackground(mixBrush(textCharFormat.background(), + format.relativeBackgroundSaturation(), + format.relativeBackgroundLightness())); } - if (!textCharFormat.fontItalic()) textCharFormat.setFontItalic(format.italic());