Open AdrienWehrle opened 2 years ago
I think I understand what you mean, but I tested on my theme and it's working fine. "self" has its keyword color when uncommented, and uses the comment-face when commented:
How did you change the face for "self"?
Yes everything is fine in your theme!
I would like to modify the default dark+ theme because it has "self" and class attributes in the same color (a light blue, see screenshot) and I would like to customize self to another color.
So my question was more about how to customize single keyword using your theme as a basis, and still keep the comment-face when commented?
So my question was more about how to customize single keyword using your theme as a basis, and still keep the comment-face when commented?
I'm afraid I don't know how. However, I don't think it's true that my theme "has self
and class attributes in the same color". Look at the following screenshots, the first one has the default syntax highlighting, and the second one has tree-sitter-hl-mode turned on (for richer syntax highlighting). In both screenshots, self
is distinct from class attribute colors. Just for reference, I pasted VSCode's screenshot too.
Thank you for your answer!
I don't think it's true that my theme "has
self
and class attributes in the same color".
I assumed your theme was the exact same as VS code dark+, but based on your three screenshots it doesn't look like it is?
I assumed your theme was the exact same as VS code dark+, but based on your three screenshots it doesn't look like it is?
Due to how VSCode and Emacs parse keywords and apply syntax highlighting differently, it's impossible to have an exact port. For instance, def
and return
are both recognized as simply the "keyword" font-face in Emacs, so having two different colors as in VSCode is not possible. Between blue and magenta, we must choose one and sacrifice the other.
But what is preventing you from setting a custom font-face for .e.g return
as below?
(defvar lawlist-print (make-face 'lawlist-print))
(set-face-attribute 'lawlist-print nil
:background "#19232d" :foreground "#fab16c")
(defvar lawlist-keywords-01
(concat "\\b\\(?:"
(regexp-opt (list "print" ))
"\\)\\b"))
(font-lock-add-keywords 'python-mode (list
(list (concat
"\\("lawlist-keywords-01"\\)") 1 'lawlist-print t)
))
Nothing really -- it didn't occur to me -- I'm more than happy to accept pull requests regarding setting custom font-faces!
I will see if I can implement it properly and will do a PR if so!
Hi!
Thank you a lot for this theme, exactly what I was looking for!
Coming initially from Spyder, I like to have the
self
for Python classes standing out. I've changed faces for custom themes I wrote (basically one line), but never managed to get the keyword to take the comment face when commented (let's say aself
commented would still be in its default color while the rest of the line would be e.g. in grey).Could you help on that?
Thank you a lot in advance!