Here 'id="keywords", means that the following entries are what we define as python keywords, 'style-ref="keyword" means that the things listed bellow should be colored with the python keyword coloring style, and then it lists the keywords: "and", "assert", "if", "for" and so on. The definition of what a keyword in python is can then be found later if you search for 'style-ref="keyword"' in a block like: This says, that the coloring style for python keywords (which are defined later in the python.lang file) should be colored in the same way as "def:keyword", which is the is the default for keywords in any supported language ("def" for default, def: refers to the default styles which are found in def.lang). There at the top you will find a list of styles looking like: lang file for the language you are interested in e.g. Or /usr/share/gtksourceview-4/styles/language-specsĪnd the The color scheme/styles are in: /usr/share/gtksourceview-3.0/styles/ lang files are (probably) found in: /usr/share/gtksourceview-3.0/styles/language-specs What color scheme you are using is set under: menu -> preferences -> Font and Colors -> Color Scheme Color Scheme dialog What language you are using is specified in the bottom of Gedit: Language selection dialog currently python (2.x) lang file of the language you are currently using. The color scheme then tells Gedit how to color a generic comment, a generic keyword and so on, based on how comments, keywords, strings and so on are defined in the. in python.lang it is defined, that # marks a comment, "for", "if" and "else" are keywords, '.' is a string and so on. lang file (there is one for each supported programming language), which defines how Gedit (or rather GTKSourceView) should understand the syntax of the programming language. There are two important parts to how the highlighting works: I don't know of a simple list, but you can find the information you are looking for if you know a bit about how the highlighting works. So to answer OP's question more directly. The best documentation I found for how the highlighting works is the documentation for GTKSourceView (, which is what Gedit uses for highlighting):īut it doesn't answer OP's question directly. So I thought I would add a thorough answer explaining what is going on. I realize I'm quite late to the party, but I had a similar issue and this thread was the first that popped up. Where are these color rules coming from, and where is the legend that explains what color means what? ps - I hate markdown # This is a comment | but this string is dark blue """This is still a string""" | Triple quotes are pink Var = some_variable | both sides of the equation are black įor is a special word, so is in | 'for', 'is', 'is', and 'in' are all blood red For example: import this: | 'import' is purple I'd think the need for this would be painfully obvious to all but I can't find it (the gedit help is useless).Īlso, from looking around, it seems there is a way to set my own color scheme, but how would I know I got all the possible terms and forms colorized? Is there a list of those somewhere?įor example, I don't want to miss strings and functions and have them both end up black and thus I'm not getting the benefit of syntax highlighting - which I guess I'm not anyway since I don't know what all the colors I'm looking at now mean Maythux Doesn't this apply only to gedit itself, and not Python? I made a text file and saved it with a. I'm looking for a simple legend that says 'this color means that' or 'comments are blue, functions are green', whatever.
0 Comments
Leave a Reply. |