rsmenon / pygments-mathematica

Mathematica/Wolfram Language lexer and highlighter for Pygments
MIT License
59 stars 8 forks source link

Updated color scheme (inspired by cloud notebooks) #10

Closed DbxDev closed 3 years ago

DbxDev commented 3 years ago

Here is a proposal for updating the library with the color scheme used in WolframCloud notebooks.

rsmenon commented 3 years ago

Thanks @DbxDev! I'm fine with this change. Could you please add a set of before/after screenshots to the PR description for posterity?

DbxDev commented 3 years ago

Here is the resulting syntax coloring for an example code of the readme:

image

Compared to current coloring:

image

The code being:

(* An example highlighting the features of
   this Pygments plugin for Mathematica *)
lissajous::usage = "An example Lissajous curve.\n" <>
                   "Definition: f(t) = (sin(3t + π/2), sin(t))"
lissajous = {Sin[2^^11 # + 0.005`10 * 1*^2 * Pi], Sin[#]} &;

With[{max = 2 Pi, min = 0},
    ParametricPlot[lissajous[t], {t, min, max}] /. x_Line :> {Dashed, x}
]