Talking about themes
Closed this issue ยท 9 comments
I saw that you have themes for your editor. I'm the author of an editor which uses QScintilla too. I want to implement theme support. So I want to ask you were to you got this them? Have created them by yourself or have you ported them from another editor? Themes need a lot of work, because you have to set colours for each lexer.
Hey @JakobDev ,
I made themes manually by hand and I agree, having colors for each lexer is a pain point because of the sheer number of lexers and non-uniform attributes for each one (one lexer has HTMLNumber
which none of the others have and so on ...).
Was looking into simplifying themes by generating them dynamically from the built-in lexers, adapting them for each theme, then storing them is json
format. I still don't know of an easy way of dynamically adapting
them to other themes, other than by hand.
Notepad++ (which also uses Scintilla) uses the xml
format for storing themes, but it uses a different system to apply a theme, which I have been meaning to look at, but haven't found the time yet. Maybe it's good?
I think converting Notepad++ files would be good. There are a lot themes for it. We need a script that has a list with all names from Notepad++ and all names from Qscintilla. This script could convert the themes with the changed names in a format that is better to read with Python like JSON.
@JakobDev
Excellent job, looks fantastic! If you could share the code, that would be great, thank you ๐
@matkuki Code is now OpenSource. All Names from Notepad++ are in namelist.json. It currently contains only a few names. The Code for loading a Theme into my Editor can be found here.
I think it will work, yes, thank you.
I will try to integrate it with ExCo as soon I get a small window of free time this week.
Hey @JakobDev ,
Sorry for the long silence, just got some time to look into this.
Do you use a self made lexer in jdTextEdit
and then apply the converted Notepad++ themes to it for each programming language?
I currently didn't have any selfmade lexers. The syntax of the thems are really easy. Lets say we have this theme:
"lexer": {
"Python": {
"Default": "#2AA198",
"Comment": "#586E75",
"Number": "#2AA198",
"SingleQuotedString": "#2AA198",
"DoubleQuotedString": "#2AA198",
"TripleSingleQuotedString": "#2AA198",
"TripleDoubleQuotedString": "#2AA198",
"UnclosedString": "#2AA198",
"Keyword": "#859900",
"ClassName": "#CB4B16",
"FunctionMethodName": "#CB4B16"
}
}
Esach lexer has the function language. The Python lexer returns Python. This function is used to identify the lexer, so it works with every lexer and you can add your own lexers. It comtians the name of the colours an thir color code.
For more information take a look at my code. The applyTheme function is the one that you need. editWidget is a Qscintilla widget. lexer can be any Lexer.