fix: the header completion window's text color not correctly set when the scheme's color doesn't have good contrast with background
This commit is contained in:
parent
4eec185ac4
commit
7b0b7c1413
|
@ -428,7 +428,7 @@ void MainWindow::updateCompileActions()
|
||||||
static bool haveGoodContrast(const QColor& c1, const QColor &c2) {
|
static bool haveGoodContrast(const QColor& c1, const QColor &c2) {
|
||||||
int lightness1 = c1.lightness();
|
int lightness1 = c1.lightness();
|
||||||
int lightness2 = c2.lightness();
|
int lightness2 = c2.lightness();
|
||||||
return std::abs(lightness1 - lightness2)>=150;
|
return std::abs(lightness1 - lightness2)>=100;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::updateEditorColorSchemes()
|
void MainWindow::updateEditorColorSchemes()
|
||||||
|
@ -478,6 +478,8 @@ void MainWindow::updateEditorColorSchemes()
|
||||||
mStatementColors->insert(StatementKind::skPreprocessor,item);
|
mStatementColors->insert(StatementKind::skPreprocessor,item);
|
||||||
mStatementColors->insert(StatementKind::skEnum,item);
|
mStatementColors->insert(StatementKind::skEnum,item);
|
||||||
mHeaderCompletionPopup->setSuggestionColor(item->foreground());
|
mHeaderCompletionPopup->setSuggestionColor(item->foreground());
|
||||||
|
} else {
|
||||||
|
mHeaderCompletionPopup->setSuggestionColor(palette().color(QPalette::Text));
|
||||||
}
|
}
|
||||||
item = pColorManager->getItem(schemeName, SYNS_AttrReservedWord);
|
item = pColorManager->getItem(schemeName, SYNS_AttrReservedWord);
|
||||||
if (item && haveGoodContrast(item->foreground(), baseColor)) {
|
if (item && haveGoodContrast(item->foreground(), baseColor)) {
|
||||||
|
|
Loading…
Reference in New Issue