Skip to content

MarauderXtreme/pygmentize-stylesheets

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pygments-Stylesheets

Jekyll and therefore Github Pages uses the rogue gem for code highlighting which itself is compatible with pygments stylesheets. Unfortunately they are not readily available and there is no up-to-date archive of those stylesheets. One can use the pygmentize programm to generate a simple css file. This helps a bit but for advanced usages in web design this lacks some support.

Especially in the case of dark and light themes which can be switched by most modern browsers a more flexible way of interacting with those stylsheets is of benefit. To keep the moving JS parts to a minimum one can interact with media-queries and CSS variables to be able to switch between dark and light themes easily.

Unfortunaly each theme comes with a unique set of CSS rules which makes it hard for a central crafted file. As of writing this (beginning of 2023) there are 283 unique variables across 176 stylesheets. Therefore an automated way to generate those files and variables is needed.

Purpose

For one this repo should serve as an up-to-date archive of the normal pygments stylesheets. Additionally it should provide generated drop-in files for more advanced use of those code highlighting themes. All those generated files should be automatically updated and release either on package updates or on a schedule. (github-actions)

Currently available stylesheets

  • each of the builtin pygments themes (see get_styles)
  • thirdparty packaged theme listed from here

See for all theme names css or themes.

Preview the themes

Find information on how to use the various generated files and preview the themes here: https://marauderxtreme.github.io/pygmentize-stylesheets/

Include further thirdparty stylesheets

Pypi was extensively searched for unique packages that provide stylesheet. If there are missing ones please check if they actually work with the scripts and send a PR. There are currently not compatible thirdparty packages that have been excluded.

Automatic archive updates

Currently there is a workflow set up that will run each sunday to check if the Pipfile.lock got updated. If there are changes those get commited and pushed. This triggers another workflow that regenerates all theme and related files.

Future

Currently even though the generated CSS variable files are name .scss they are in fact simple CSS files. Maybe it will be possible to generate nested SCSS for the central highlighting file.

Excluded stylesheets

  • pygments-style-goggles (depends on goggles and breaks everything)
  • pygments-style-soft-era (has one broken CSS-rule)

Is it any good

Yes