Closed red-kite closed 7 months ago
It does not look nice with dark themes:
I recommend that you take colors from QPalette where possible, rather than hard-coding them. If QPalette doesn't have the needed colors, please define both light and dark versions, you can add them after this line: https://github.com/retext-project/retext/blob/adeba3840c434a0e59b86fc584161820cb94714e/ReText/editor.py#L54
So the only thing remaining is my comment about dark themes.
Please excuse being that quiet on this for so long. Thank you @mitya57 for guiding towards the solution via QPalette or hardcoded colors. I'd prefer latter for decent appearance with soft border and very little transparency (finetuning possible) …but ran into issues:
from ReText.editor import getColor
)Thanks to motivation by @donjan I tried some more and pushed https://github.com/retext-project/retext/pull/634/commits/8935a93595c6701c8b90e74eca6f3a0e4b86a012 for further use…
-> Help appreciated
Some alternative code (palette usage found on the internet last year, no alpha):
self.setStyleSheet('''
border: 1px solid palette(mid);
border-radius: 3px;
background: palette(base);
''')
Resources:
https://stackoverflow.com/a/2756376 suggests ("not to use the palette and go for Qt Style Sheet") https://stackoverflow.com/a/6876509 (long struggle to convert QColor to HexArgb!)
see commit msg, note that dark-mode still not tested by me
unsure about position of hex_rgba() in file -- kept it close to it's class
(to-string-conversion of QColor could be part of getColor(colorName, rgba=False) but I don't like this because function gets blown up for other use)
Thank you!
Tested with dark theme (QT_STYLE_OVERRIDE=Adwaita-Dark), it looks good!
Although, the transparency is barely visible, so maybe it's an overcomplication and using the palette color would be enough. But as you already implemented it this way, I did not change.
Please:
super().__init__(parent)
.setText('')
additional tosetVisible(False)
Thank you for creating and maintaining ReText!