forked from qt-creator/qt-creator
Color schemes: Fix wrong colors for unset values
Defaulting to C_TEXT in that case is correct, but the values for C_TEXT are set via the palette, so other display features like the current line highlighting and the block visualization, which are painted _below_ the text, are not overridden. So, the correct way for a style to set the same foreground and background colors as C_TEXT, is to leave these colors unset. Fixes: QTCREATORBUG-21661 Change-Id: I8cdb73e8edc5e3883e1ef107bd1c2b29e6d75b9c Reviewed-by: Marco Bubke <marco.bubke@qt.io> Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -406,12 +406,9 @@ bool FontSettings::loadColorScheme(const QString &fileName,
|
|||||||
if (!m_scheme.contains(id)) {
|
if (!m_scheme.contains(id)) {
|
||||||
Format format;
|
Format format;
|
||||||
const Format &descFormat = desc.format();
|
const Format &descFormat = desc.format();
|
||||||
if (descFormat == format && m_scheme.contains(C_TEXT)) {
|
// Default fallback for background and foreground is C_TEXT, which is set through
|
||||||
// Default format -> Text
|
// the editor's palette, i.e. we leave these as invalid colors in that case
|
||||||
const Format textFormat = m_scheme.formatFor(C_TEXT);
|
if (descFormat != format || !m_scheme.contains(C_TEXT)) {
|
||||||
format.setForeground(textFormat.foreground());
|
|
||||||
format.setBackground(textFormat.background());
|
|
||||||
} else {
|
|
||||||
format.setForeground(descFormat.foreground());
|
format.setForeground(descFormat.foreground());
|
||||||
format.setBackground(descFormat.background());
|
format.setBackground(descFormat.background());
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user