diff options
Diffstat (limited to 'pygments/styles')
-rw-r--r-- | pygments/styles/__init__.py | 2 | ||||
-rw-r--r-- | pygments/styles/arduino.py | 4 | ||||
-rw-r--r-- | pygments/styles/paraiso_dark.py | 2 | ||||
-rw-r--r-- | pygments/styles/paraiso_light.py | 2 | ||||
-rw-r--r-- | pygments/styles/solarized.py | 129 |
5 files changed, 135 insertions, 4 deletions
diff --git a/pygments/styles/__init__.py b/pygments/styles/__init__.py index 839a9b78..1f39c692 100644 --- a/pygments/styles/__init__.py +++ b/pygments/styles/__init__.py @@ -44,6 +44,8 @@ STYLE_MAP = { 'arduino': 'arduino::ArduinoStyle', 'rainbow_dash': 'rainbow_dash::RainbowDashStyle', 'abap': 'abap::AbapStyle', + 'solarized-dark': 'solarized::SolarizedDarkStyle', + 'solarized-light': 'solarized::SolarizedLightStyle', } diff --git a/pygments/styles/arduino.py b/pygments/styles/arduino.py index 57e3809e..b500b6d9 100644 --- a/pygments/styles/arduino.py +++ b/pygments/styles/arduino.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -""" +u""" pygments.styles.arduino ~~~~~~~~~~~~~~~~~~~~~~~ @@ -15,7 +15,7 @@ from pygments.token import Keyword, Name, Comment, String, Error, \ class ArduinoStyle(Style): - """ + u""" The Arduino® language style. This style is designed to highlight the Arduino source code, so exepect the best results with it. """ diff --git a/pygments/styles/paraiso_dark.py b/pygments/styles/paraiso_dark.py index 5f334bb9..68abb9f6 100644 --- a/pygments/styles/paraiso_dark.py +++ b/pygments/styles/paraiso_dark.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -""" +u""" pygments.styles.paraiso_dark ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/pygments/styles/paraiso_light.py b/pygments/styles/paraiso_light.py index a8112819..186e4775 100644 --- a/pygments/styles/paraiso_light.py +++ b/pygments/styles/paraiso_light.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -""" +u""" pygments.styles.paraiso_light ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/pygments/styles/solarized.py b/pygments/styles/solarized.py new file mode 100644 index 00000000..a1790b08 --- /dev/null +++ b/pygments/styles/solarized.py @@ -0,0 +1,129 @@ +# -*- coding: utf-8 -*- +""" + pygments.styles.solarized + ~~~~~~~~~~~~~~~~~~~~~~~~ + + Solarized by Camil Staps + + A Pygments style for the Solarized themes (licensed under MIT). + See: https://github.com/altercation/solarized + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +from pygments.style import Style +from pygments.token import Comment, Error, Generic, Keyword, Name, Number, \ + Operator, String, Token + + +def make_style(colors): + return { + Token: colors['base0'], + + Comment: 'italic ' + colors['base01'], + Comment.Hashbang: colors['base01'], + Comment.Multiline: colors['base01'], + Comment.Preproc: 'noitalic ' + colors['magenta'], + Comment.PreprocFile: 'noitalic ' + colors['base01'], + + Keyword: colors['green'], + Keyword.Constant: colors['cyan'], + Keyword.Declaration: colors['cyan'], + Keyword.Namespace: colors['orange'], + Keyword.Type: colors['yellow'], + + Operator: colors['base01'], + Operator.Word: colors['green'], + + Name.Builtin: colors['blue'], + Name.Builtin.Pseudo: colors['blue'], + Name.Class: colors['blue'], + Name.Constant: colors['blue'], + Name.Decorator: colors['blue'], + Name.Entity: colors['blue'], + Name.Exception: colors['blue'], + Name.Function: colors['blue'], + Name.Function.Magic: colors['blue'], + Name.Label: colors['blue'], + Name.Namespace: colors['blue'], + Name.Tag: colors['blue'], + Name.Variable: colors['blue'], + Name.Variable.Global:colors['blue'], + Name.Variable.Magic: colors['blue'], + + String: colors['cyan'], + String.Doc: colors['base01'], + String.Regex: colors['orange'], + + Number: colors['cyan'], + + Generic.Deleted: colors['red'], + Generic.Emph: 'italic', + Generic.Error: colors['red'], + Generic.Heading: 'bold', + Generic.Subheading: 'underline', + Generic.Inserted: colors['green'], + Generic.Strong: 'bold', + Generic.Traceback: colors['blue'], + + Error: 'bg:' + colors['red'], + } + + +DARK_COLORS = { + 'base03': '#002b36', + 'base02': '#073642', + 'base01': '#586e75', + 'base00': '#657b83', + 'base0': '#839496', + 'base1': '#93a1a1', + 'base2': '#eee8d5', + 'base3': '#fdf6e3', + 'yellow': '#b58900', + 'orange': '#cb4b16', + 'red': '#dc322f', + 'magenta': '#d33682', + 'violet': '#6c71c4', + 'blue': '#268bd2', + 'cyan': '#2aa198', + 'green': '#859900', +} + +LIGHT_COLORS = { + 'base3': '#002b36', + 'base2': '#073642', + 'base1': '#586e75', + 'base0': '#657b83', + 'base00': '#839496', + 'base01': '#93a1a1', + 'base02': '#eee8d5', + 'base03': '#fdf6e3', + 'yellow': '#b58900', + 'orange': '#cb4b16', + 'red': '#dc322f', + 'magenta': '#d33682', + 'violet': '#6c71c4', + 'blue': '#268bd2', + 'cyan': '#2aa198', + 'green': '#859900', +} + + +class SolarizedDarkStyle(Style): + """ + The solarized style, dark. + """ + + styles = make_style(DARK_COLORS) + background_color = DARK_COLORS['base03'] + highlight_color = DARK_COLORS['base02'] + +class SolarizedLightStyle(SolarizedDarkStyle): + """ + The solarized style, light. + """ + + styles = make_style(LIGHT_COLORS) + background_color = LIGHT_COLORS['base03'] + highlight_color = LIGHT_COLORS['base02'] |