Our syntax highlighter highlight.js
has received a complete ground up rewrite of the LaTeX grammar in its latest 10.3 release.
This comes with some changes to the CSS classes used by the highlighter.
This makes it absolutely necessary to change the stylesheet defining the colors used for highlighting in tex.sx! It is desirable to perform these changes simultaneously with the switch to version 10.3.
This question serves two purposes:
- It is an opportunity for the TeX.sx community to provide some feedback on the currently used colors (not the highlighter, just the colors) and propose changes to them.
- A place for the Stack Exchange employee(s) responsible for implementing the change to find all the necessary information in one place and communicate how the changes will be performed.
In version 10.2, these were the classes used for highlighting LaTeX:
class use color on tex.sx
-------------------------------------------------
tag control sequences unstyled
name cs name (without \) #b75501
number dimensions #b75501
string macro arguments #54790d
formula math mode unstyled
comment comments #656e77
These categories were inadequate and recognized unreliably, which is why the rewrite was done.
The new grammar uses the following classes (proposed colors not yet final):
class use proposed color on tex.sx
----------------------------------------------------------
keyword control sequences #934301
params macro parameters #523014
built_in $, &, ^ and _ #934301
comment comments #75808a
meta magic comments #1474b8
string verbatim text #54790d
link URLs #79750d
This list will likely grow in future versions of highlight.js
.
The code background is #f6f6f6
, the default color is #2f3337
.
Other programming languages are rare on TeX.sx but not unheard of. Most notably:
- Lua, which uses the classes
keyword
,built_in
,literal
,title
,function
,params
,string
andcomment
. - Python, which uses
keyword
,built_in
,literal
,title
,meta
,subst
,string
,number
,params
,function
,class
,comment
andmeta
- Other langauges that pop up from time to time will probably use a similar set of classes.
- In anticipation of additions to the grammar in the near future, I'd like to consider
section
andattr
as well.
Here are the color values of all the mentioned classes (proposed colors not final yet):
class current color proposed color
------------------------------------------
keyword #015692 #934301
built_in #b75501 #934301
params unstyled #523014
comment #656e77 #75808a
meta #015692 #1474b8
string #54790d #54790d
link #54790d #79750d
literal #b75501 #015692
title #b75501 #015692
name #b75501 #015692
number #b75501 #015692
function unstyled #015692
tag unstyled #015692
section #015692 #015692
attr #015692 #600193
subst #2f3337 #2f3337
class unstyled unstyled
formula unstyled unstyled
Other ways of highlighting, like bold font, are also possible, of course.
highlight.js
.