├── .gitignore ├── README.md ├── gruvbox.css ├── gruvbox ├── __init__.py └── style.py ├── screenshot.png └── setup.py /.gitignore: -------------------------------------------------------------------------------- 1 | ### https://raw.github.com/github/gitignore/master/Python.gitignore 2 | 3 | # Byte-compiled / optimized / DLL files 4 | __pycache__/ 5 | *.py[cod] 6 | *$py.class 7 | 8 | # C extensions 9 | *.so 10 | 11 | # Distribution / packaging 12 | .Python 13 | env/ 14 | build/ 15 | develop-eggs/ 16 | dist/ 17 | downloads/ 18 | eggs/ 19 | .eggs/ 20 | lib/ 21 | lib64/ 22 | parts/ 23 | sdist/ 24 | var/ 25 | *.egg-info/ 26 | .installed.cfg 27 | *.egg 28 | 29 | # PyInstaller 30 | # Usually these files are written by a python script from a template 31 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 32 | *.manifest 33 | *.spec 34 | 35 | # Installer logs 36 | pip-log.txt 37 | pip-delete-this-directory.txt 38 | 39 | # Unit test / coverage reports 40 | htmlcov/ 41 | .tox/ 42 | .coverage 43 | .coverage.* 44 | .cache 45 | nosetests.xml 46 | coverage.xml 47 | *,cover 48 | 49 | # Translations 50 | *.mo 51 | *.pot 52 | 53 | # Django stuff: 54 | *.log 55 | 56 | # Sphinx documentation 57 | docs/_build/ 58 | 59 | # PyBuilder 60 | target/ 61 | 62 | 63 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # gruvbox for pygments 2 | 3 | [Gruvbox](https://github.com/morhetz/gruvbox) is an excellent "retro 4 | groove color scheme" for Vim. This is an attempt at adapting it for use 5 | as a [Pygments](http://pygments.org) theme. 6 | 7 | Gruvbox is a highly customized Vim color scheme, and it can look quite 8 | different when viewing different file formats (Ruby vs. Clojure is a 9 | good example). This Pygments theme is designed to mirror, as closely 10 | as possible, the Clojure file syntax highlighting in dark mode. Other 11 | languages do still look quite nice with this Pygments theme, it's 12 | just that they may not look very much like their corresponding syntax 13 | highlighting with the Gruvbox color scheme in Vim. 14 | 15 | To create this pygments theme, I used 16 | [vim2pygments](https://github.com/honza/vim2pygments) to convert 17 | `gruvbox.vim` into a pygments theme file, and then made a few additional 18 | tweaks to the resulting `gruvbox.py` to get the Clojure syntax 19 | highlighting looking as much as possible like it does in Vim. The 20 | conversion process was a little trickier than usual, because the author 21 | of Gruvbox utilized the power of Vimscript to do some clever things and 22 | basically generate the highlighting information programmatically instead 23 | of hard-coding it into the file like most Vim color schemes do. Because 24 | vim2pygments needs to see a bunch of lines starting with `hi`, I had to 25 | change the `execute` command that sources each would-be `hi` command 26 | on-the-fly, and instead have it append each `hi` command to a temporary 27 | file that vim2pygments could understand. It was hacky, but it worked. 28 | 29 | # Usage / Installation 30 | 31 | ## Blog 32 | If you just want to use the Gruvbox theme for the code blocks on your 33 | Jekyll blog or whatever, simply replace your `pygments.css` with the one 34 | in this repo and you're good to go. You may wish to make a backup of 35 | your old css file if you ever change your mind. 36 | 37 | For more general use with pygments, there are two methods of installing: 38 | 39 | ## Manual 40 | Find your pygments installation path (on my system, it's located at 41 | `/usr/local/lib/python2.7/site-packages/pygments`) and rename the 42 | `style.py` from this repo to `gruvbox.py`, and move it into the `styles` 43 | subdirectory of the path above. 44 | 45 | ## Automatic 46 | For those who do not want to directly add to the source directories 47 | of the project, clone this repo to a suitable place, for example, 48 | `~/.local/scripts/gruvbox-pygments`, change directory to this location 49 | and run: 50 | 51 | sudo python setup.py develop 52 | 53 | This will hook in this style into `pygments` without editing the source 54 | directories of `pygments` iteself. Do not delete this directory as this 55 | where python will be looking for this style file. 56 | 57 | # Uninstall 58 | 59 | ## Blog 60 | Replace the `pygments.css` with your backup for the Jekyll blog or 61 | whatever. 62 | 63 | ## Manual 64 | Remove the `gruvbox.py` file from the installation path. 65 | 66 | ## Automatic 67 | Remove just as you would any other python package. For example with `pip`: 68 | 69 | sudo pip uninstall gruvbox-pygments 70 | 71 | You can now safely remove the directory containing this repo. 72 | 73 | # Screenshot 74 | 75 | !["gruvbox pygments theme"](https://github.com/daveyarwood/gruvbox-pygments/blob/master/screenshot.png?raw=true "gruvbox pygments theme") 76 | -------------------------------------------------------------------------------- /gruvbox.css: -------------------------------------------------------------------------------- 1 | .highlight .hll { background-color: #ffffcc } 2 | .highlight { background: #282828; color: #ebdbb2; background-color: #282828 } 3 | .highlight .c { color: #928374; font-style: italic; background-color: #282828 } /* Comment */ 4 | .highlight .err { color: #ebdbb2; background-color: #282828 } /* Error */ 5 | .highlight .esc { color: #ebdbb2; background-color: #282828 } /* Escape */ 6 | .highlight .g { color: #ebdbb2; background-color: #282828 } /* Generic */ 7 | .highlight .k { color: #fe8019; background-color: #282828 } /* Keyword */ 8 | .highlight .l { color: #ebdbb2; background-color: #282828 } /* Literal */ 9 | .highlight .n { color: #ebdbb2; background-color: #282828 } /* Name */ 10 | .highlight .o { color: #fe8019; background-color: #282828 } /* Operator */ 11 | .highlight .x { color: #ebdbb2; background-color: #282828 } /* Other */ 12 | .highlight .p { color: #ebdbb2; background-color: #282828 } /* Punctuation */ 13 | .highlight .ch { color: #928374; font-style: italic; background-color: #282828 } /* Comment.Hashbang */ 14 | .highlight .cm { color: #928374; font-style: italic; background-color: #282828 } /* Comment.Multiline */ 15 | .highlight .cp { color: #8ec07c; background-color: #282828 } /* Comment.Preproc */ 16 | .highlight .c1 { color: #928374; font-style: italic; background-color: #282828 } /* Comment.Single */ 17 | .highlight .cs { color: #928374; font-style: italic; background-color: #282828 } /* Comment.Special */ 18 | .highlight .gd { color: #282828; background-color: #fb4934 } /* Generic.Deleted */ 19 | .highlight .ge { color: #83a598; text-decoration: underline; background-color: #282828 } /* Generic.Emph */ 20 | .highlight .gr { color: #ebdbb2; font-weight: bold; background-color: #fb4934 } /* Generic.Error */ 21 | .highlight .gh { color: #b8bb26; font-weight: bold; background-color: #282828 } /* Generic.Heading */ 22 | .highlight .gi { color: #282828; background-color: #b8bb26 } /* Generic.Inserted */ 23 | .highlight .go { color: #504945; background-color: #282828 } /* Generic.Output */ 24 | .highlight .gp { color: #ebdbb2; background-color: #282828 } /* Generic.Prompt */ 25 | .highlight .gs { color: #ebdbb2; background-color: #282828 } /* Generic.Strong */ 26 | .highlight .gu { color: #b8bb26; font-weight: bold; background-color: #282828 } /* Generic.Subheading */ 27 | .highlight .gt { color: #ebdbb2; font-weight: bold; background-color: #fb4934 } /* Generic.Traceback */ 28 | .highlight .kc { color: #fe8019; background-color: #282828 } /* Keyword.Constant */ 29 | .highlight .kd { color: #fe8019; background-color: #282828 } /* Keyword.Declaration */ 30 | .highlight .kn { color: #fe8019; background-color: #282828 } /* Keyword.Namespace */ 31 | .highlight .kp { color: #fe8019; background-color: #282828 } /* Keyword.Pseudo */ 32 | .highlight .kr { color: #fe8019; background-color: #282828 } /* Keyword.Reserved */ 33 | .highlight .kt { color: #fabd2f; background-color: #282828 } /* Keyword.Type */ 34 | .highlight .ld { color: #ebdbb2; background-color: #282828 } /* Literal.Date */ 35 | .highlight .m { color: #d3869b; background-color: #282828 } /* Literal.Number */ 36 | .highlight .s { color: #b8bb26; background-color: #282828 } /* Literal.String */ 37 | .highlight .na { color: #b8bb26; font-weight: bold; background-color: #282828 } /* Name.Attribute */ 38 | .highlight .nb { color: #fabd2f; background-color: #282828 } /* Name.Builtin */ 39 | .highlight .nc { color: #ebdbb2; background-color: #282828 } /* Name.Class */ 40 | .highlight .no { color: #d3869b; background-color: #282828 } /* Name.Constant */ 41 | .highlight .nd { color: #ebdbb2; background-color: #282828 } /* Name.Decorator */ 42 | .highlight .ni { color: #fabd2f; background-color: #282828 } /* Name.Entity */ 43 | .highlight .ne { color: #fb4934; background-color: #282828 } /* Name.Exception */ 44 | .highlight .nf { color: #fabd2f; background-color: #282828 } /* Name.Function */ 45 | .highlight .nl { color: #fb4934; background-color: #282828 } /* Name.Label */ 46 | .highlight .nn { color: #ebdbb2; background-color: #282828 } /* Name.Namespace */ 47 | .highlight .nx { color: #ebdbb2; background-color: #282828 } /* Name.Other */ 48 | .highlight .py { color: #ebdbb2; background-color: #282828 } /* Name.Property */ 49 | .highlight .nt { color: #fb4934; background-color: #282828 } /* Name.Tag */ 50 | .highlight .nv { color: #ebdbb2; background-color: #282828 } /* Name.Variable */ 51 | .highlight .ow { color: #fe8019; background-color: #282828 } /* Operator.Word */ 52 | .highlight .w { color: #ebdbb2; background-color: #282828 } /* Text.Whitespace */ 53 | .highlight .mb { color: #d3869b; background-color: #282828 } /* Literal.Number.Bin */ 54 | .highlight .mf { color: #d3869b; background-color: #282828 } /* Literal.Number.Float */ 55 | .highlight .mh { color: #d3869b; background-color: #282828 } /* Literal.Number.Hex */ 56 | .highlight .mi { color: #d3869b; background-color: #282828 } /* Literal.Number.Integer */ 57 | .highlight .mo { color: #d3869b; background-color: #282828 } /* Literal.Number.Oct */ 58 | .highlight .sb { color: #b8bb26; background-color: #282828 } /* Literal.String.Backtick */ 59 | .highlight .sc { color: #b8bb26; background-color: #282828 } /* Literal.String.Char */ 60 | .highlight .sd { color: #b8bb26; background-color: #282828 } /* Literal.String.Doc */ 61 | .highlight .s2 { color: #b8bb26; background-color: #282828 } /* Literal.String.Double */ 62 | .highlight .se { color: #b8bb26; background-color: #282828 } /* Literal.String.Escape */ 63 | .highlight .sh { color: #b8bb26; background-color: #282828 } /* Literal.String.Heredoc */ 64 | .highlight .si { color: #b8bb26; background-color: #282828 } /* Literal.String.Interpol */ 65 | .highlight .sx { color: #b8bb26; background-color: #282828 } /* Literal.String.Other */ 66 | .highlight .sr { color: #b8bb26; background-color: #282828 } /* Literal.String.Regex */ 67 | .highlight .s1 { color: #b8bb26; background-color: #282828 } /* Literal.String.Single */ 68 | .highlight .ss { color: #83a598; background-color: #282828 } /* Literal.String.Symbol */ 69 | .highlight .bp { color: #fabd2f; background-color: #282828 } /* Name.Builtin.Pseudo */ 70 | .highlight .vc { color: #ebdbb2; background-color: #282828 } /* Name.Variable.Class */ 71 | .highlight .vg { color: #ebdbb2; background-color: #282828 } /* Name.Variable.Global */ 72 | .highlight .vi { color: #ebdbb2; background-color: #282828 } /* Name.Variable.Instance */ 73 | .highlight .il { color: #d3869b; background-color: #282828 } /* Literal.Number.Integer.Long */ 74 | -------------------------------------------------------------------------------- /gruvbox/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daveyarwood/gruvbox-pygments/36ed771df54a3ce3d0a318b0d51dd2817dce2508/gruvbox/__init__.py -------------------------------------------------------------------------------- /gruvbox/style.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | Gruvbox Colorscheme 4 | ~~~~~~~~~~~~~~~~~ 5 | A retro groove color scheme for Vim. 6 | https://github.com/morhetz/gruvbox 7 | 8 | © 2012-2015 Pavel Pertsev 9 | Adapted for Pygments by Dave Yarwood 10 | 11 | Converted by Vim Colorscheme Converter 12 | https://github.com/honza/vim2pygments 13 | """ 14 | from pygments.style import Style 15 | from pygments.token import Token, Comment, Name, Keyword, Generic, Number, Operator, String 16 | 17 | class GruvboxStyle(Style): 18 | """ Retro groove color scheme for Vim by Github: @morhetz """ 19 | 20 | background_color = '#282828' 21 | styles = { 22 | Comment.Preproc: 'noinherit #8ec07c', 23 | Comment: '#928374 italic', 24 | Generic.Deleted: 'noinherit #282828 bg:#fb4934', 25 | Generic.Emph: '#83a598 underline', 26 | Generic.Error: 'bg:#fb4934 bold', 27 | Generic.Heading: '#b8bb26 bold', 28 | Generic.Inserted: 'noinherit #282828 bg:#b8bb26', 29 | Generic.Output: 'noinherit #504945', 30 | Generic.Prompt: '#ebdbb2', 31 | Generic.Strong: '#ebdbb2', 32 | Generic.Subheading: '#b8bb26 bold', 33 | Generic.Traceback: 'bg:#fb4934 bold', 34 | Generic: '#ebdbb2', 35 | Keyword.Type: 'noinherit #fabd2f', 36 | Keyword: 'noinherit #fe8019', 37 | Name.Attribute: '#b8bb26 bold', 38 | Name.Builtin: '#fabd2f', 39 | Name.Constant: 'noinherit #d3869b', 40 | Name.Entity: 'noinherit #fabd2f', 41 | Name.Exception: 'noinherit #fb4934', 42 | Name.Function: '#fabd2f', 43 | Name.Label: 'noinherit #fb4934', 44 | Name.Tag: 'noinherit #fb4934', 45 | Name.Variable: 'noinherit #ebdbb2', 46 | Name: '#ebdbb2', 47 | Number.Float: 'noinherit #d3869b', 48 | Number: 'noinherit #d3869b', 49 | Operator: '#fe8019', 50 | String.Symbol: '#83a598', 51 | String: 'noinherit #b8bb26', 52 | Token: 'noinherit #ebdbb2 bg:#282828', 53 | } 54 | -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daveyarwood/gruvbox-pygments/36ed771df54a3ce3d0a318b0d51dd2817dce2508/screenshot.png -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup, find_packages 2 | 3 | setup(name='gruvbox-pygments', 4 | description='Pygments style using the gruvbox color scheme.', 5 | packages=find_packages(), 6 | entry_points=""" 7 | [pygments.styles] 8 | gruvbox = gruvbox.style:GruvboxStyle 9 | """ 10 | ) 11 | --------------------------------------------------------------------------------