Sass makes CSS fun again.
Pygments is a generic syntax highlighter for general use in all kinds of software such as forum systems, wikis or other applications that need to prettify source code.
Pygments comes with a set of builtin styles, written as Python programs and not CSS files, for code highlighting. You have to generate a CSS file using the command line. I just figured I'd save someone all this work in the future and generate all the CSS files based on the Pygments builtins.
N.B. Both CSS and Sass (using SCSS syntax) files have been pre-generated for your convenience.
Navigate to the styles
directory and choose one of the Pygments styles that has already been converted to CSS or Sass.
They were generated as follows:
$ cd sass-pygments
$ virtualenv .env
$ . .env/bin/activate
(.env) $ bundle && pip install -r requirements.txt
(.env) $ ./bin/convert-all
N.B. paraiso_dark
and paraiso_light
styles could not be generated since pygmentize
could not find the style classes 'Paraiso_DarkStyle' and 'Paraiso_LightStyle' in the style module.
This part will show you how to setup your system to perform the conversions yourself.
N.B. This will only be necessary if you have custom Pygments style that cannot be found in the styles
directory.
You will need:
-
Python 2.7.x
- pip
- virtualenv
-
Ruby 2.x
- bundler
Once the requirements are met, execute the instructions below and you should be all set to process your own Pygments style files.
$ cd /tmp
$ git clone git@github.com:dwayne/sass-pygments.git
$ cd sass-pygments
$ virtualenv .env
$ . .env/bin/activate
(.env) $ bundle && pip install -r requirements.txt
Now you can run the script on a style to convert it to CSS and Sass.
(.env) $ STYLES_DIR=/tmp/styles ./bin/convert style
For e.g. style
can be one of the builtins as listed below. But more than likely it will be the name of a custom style you want generated.
(.env) $ ./bin/show-builtins
algol_nu
algol
arduino
autumn
borland
bw
colorful
default
emacs
friendly
fruity
igor
lovelace
manni
monokai
murphy
native
paraiso_dark
paraiso_light
pastie
perldoc
rrt
tango
trac
vim
vs
xcode
When done, just deactivate the virtual environment.
(.env) $ deactivate
$ ...
That's it.
Copyright (c) 2012-2016 Dwayne Crooks.