Python code, idle colors

201 views
Skip to first unread message

Bartolomé Sintes

unread,
Jan 14, 2014, 5:56:30 PM1/14/14
to highl...@googlegroups.com
Hi,

I have tried to use highlight to show Python code with the colors that IDLE GUI use.

Some elements (keywords, string, etc.) work OK, but not all.

For example, the name of the functions (print, input, etc.) are shown in IDLE in a purple color, but I would say that highlight does not assign a class to the function names.

Is it possible to show function names in a purple color?

Thanking you in advance,
Barto

Ivan Sagalaev

unread,
Jan 15, 2014, 4:29:29 AM1/15/14
to highl...@googlegroups.com
It is theoretically possible with a couple of issues:

- Adding all Python built-ins to the library will add about 1.5K to its
size which is not what we can afford right now.

- One of the design principles behind highlight.js is keeping
highlighting as minimal as to not become a distraction from reading
code, so it is quite expected that imitations of existing color schemes
may lack some of their features.

Short version: it's not a big deal, leave those out :-)
Message has been deleted

Jan Kvapil

unread,
Apr 4, 2014, 5:27:28 AM4/4/14
to highl...@googlegroups.com
Hi,
I have similar issues. I am using monokai_sublime.min.css and the 
code that is not highlighted for Python language is:
  • all operators +,*,-,/,%,  relations =, or boolean ==, !=..
  • built-in functions max(). min(), round(),...
  • functions arguments e.g. def foo(arg1, arg2)
  • boolean True, False
I understand it may be hard to cover those, but I think it would help a lot,
the eyes are really used to those, and it increases the readability.

Ivan Sagalaev

unread,
Jul 25, 2014, 12:39:13 AM7/25/14
to highl...@googlegroups.com
Hi Jan,

> * all operators +,*,-,/,%, relations =, or boolean ==, !=..
> * built-in functions max(). min(), round(),...
> * functions arguments e.g. def foo(arg1, arg2)
> * boolean True, False
> ...
> the eyes are really used to those, and it increases the readability.

Speaking for myself, I can say that code with all this stuff highlighted
in different color is *really* hard to read. May be it's just me, I'm
not aware of any usability study of this issue. But to put it simply,
highlight.js is not a syntax highlighter you're looking for if you need
this.
Reply all
Reply to author
Forward
0 new messages