ColinDuquesnoy / QDarkStyleSheet

A dark style sheet for QtWidgets application
Other
2.83k stars 730 forks source link

Add a stylesheet for QScintilla #122

Open sborho opened 5 years ago

sborho commented 5 years ago

thank you

flutefreak7 commented 5 years ago

I don't think you can theme the QsciScintilla editor with Qt Style Sheets - the Scintilla editor has it's own methods for setting colors of the background, text, formatters, etc, which goes beyond what Qt style sheets do. I feel like a lot of work would have to be done in the Qt wrapper for Scintilla to translate style sheet properties to the necessary properties on the editor - which would be very complicated when you start dealing with Lexers, Syntax Highlighting, Formatters for Selection, Find/Replace, etc.

Here's some old evidence that it's not available. This isn't definitive, but at least supports my statement: https://www.riverbankcomputing.com/pipermail/qscintilla/2008-October/000373.html

For my application I had to develop my own color pallette for the editor and syntax highlighting lexer I built to match the qdarkstyle colors.

flutefreak7 commented 5 years ago

Hmm, I do see a mention in the Scintilla Changelog about CSS styling for GTK.

"Switch from deprecated style calls to CSS styling."

https://www.scintilla.org/ScintillaHistory.html

dpizetta commented 5 years ago

Need some more checks it should be nice if it works @flutefreak7

dpizetta commented 5 years ago

@goanpeca any thoughts about this? Tks

goanpeca commented 5 years ago

No idea on the topic, would have to investigate

aquila-const commented 1 year ago

Although there is no style sheet you can probably do a custom settings file, parse it and feed it into the methods given within QsciScintilla. For example:

self.editor = QsciScintilla()
self.editor.setPaper(QColor('#151516')) # this changes the text editor background
self.editor.setColor(QColor('#FFFFFF')) # set text color
self.editor.setCaretForegroundColor(QColor('#FFFFFF')) # sets text caret color

Found it here: https://riverbankcomputing.com/pipermail/pyqt/2009-July/023783.html

Works in PyQt6.

Hope this helps.