mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-28 20:45:47 +00:00
Compute the highlighting color from AlternateBase and Highlight roles (#10073)
This commit is contained in:
parent
87c85303c5
commit
744f6e3cd8
@ -277,15 +277,18 @@ void ViewSourceWidget::realUpdateView()
|
|||||||
|
|
||||||
//the real highlighting is done with an ExtraSelection
|
//the real highlighting is done with an ExtraSelection
|
||||||
QTextCharFormat format;
|
QTextCharFormat format;
|
||||||
|
{
|
||||||
|
// We create a new color with the lightness of AlternateBase and
|
||||||
|
// the hue and saturation of Highlight
|
||||||
QPalette palette = viewSourceTV->palette();
|
QPalette palette = viewSourceTV->palette();
|
||||||
//Alternative:
|
QBrush alt = palette.alternateBase();
|
||||||
// QColor bg = palette.color(QPalette::Active,QPalette::Highlight);
|
QColor high = palette.highlight().color().toHsl();
|
||||||
// bg.setAlpha(64);
|
QColor col = QColor::fromHsl(high.hue(),
|
||||||
// format.setBackground(QBrush(bg));
|
high.hslSaturation(),
|
||||||
//Other alternatives:
|
alt.color().lightness());
|
||||||
//format.setBackground(palette.light());
|
alt.setColor(col);
|
||||||
//format.setBackground(palette.alternateBase());
|
format.setBackground(alt);
|
||||||
format.setBackground(palette.toolTipBase());
|
}
|
||||||
format.setProperty(QTextFormat::FullWidthSelection, true);
|
format.setProperty(QTextFormat::FullWidthSelection, true);
|
||||||
QTextEdit::ExtraSelection sel;
|
QTextEdit::ExtraSelection sel;
|
||||||
sel.format = format;
|
sel.format = format;
|
||||||
|
Loading…
Reference in New Issue
Block a user