Back to index

moin  1.9.0~rc2
tango.py
Go to the documentation of this file.
00001 # -*- coding: utf-8 -*-
00002 """
00003     pygments.styles.tango
00004     ~~~~~~~~~~~~~~~~~~~~~
00005 
00006     The Crunchy default Style inspired from the color palette from
00007     the Tango Icon Theme Guidelines.
00008 
00009     http://tango.freedesktop.org/Tango_Icon_Theme_Guidelines
00010 
00011     Butter:     #fce94f     #edd400     #c4a000
00012     Orange:     #fcaf3e     #f57900     #ce5c00
00013     Chocolate:  #e9b96e     #c17d11     #8f5902
00014     Chameleon:  #8ae234     #73d216     #4e9a06
00015     Sky Blue:   #729fcf     #3465a4     #204a87
00016     Plum:       #ad7fa8     #75507b     #5c35cc
00017     Scarlet Red:#ef2929     #cc0000     #a40000
00018     Aluminium:  #eeeeec     #d3d7cf     #babdb6
00019                 #888a85     #555753     #2e3436
00020 
00021     Not all of the above colors are used; other colors added:
00022         very light grey: #f8f8f8  (for background)
00023 
00024     This style can be used as a template as it includes all the known
00025     Token types, unlike most (if not all) of the styles included in the
00026     Pygments distribution.
00027 
00028     However, since Crunchy is intended to be used by beginners, we have strived
00029     to create a style that gloss over subtle distinctions between different
00030     categories.
00031 
00032     Taking Python for example, comments (Comment.*) and docstrings (String.Doc)
00033     have been chosen to have the same style.  Similarly, keywords (Keyword.*),
00034     and Operator.Word (and, or, in) have been assigned the same style.
00035 
00036     :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS.
00037     :license: BSD, see LICENSE for details.
00038 """
00039 
00040 from pygments.style import Style
00041 from pygments.token import Keyword, Name, Comment, String, Error, \
00042      Number, Operator, Generic, Whitespace, Punctuation, Other, Literal
00043 
00044 
00045 class TangoStyle(Style):
00046     """
00047     The Crunchy default Style inspired from the color palette from
00048     the Tango Icon Theme Guidelines.
00049     """
00050 
00051     # work in progress...
00052 
00053     background_color = "#f8f8f8"
00054     default_style = ""
00055 
00056     styles = {
00057         # No corresponding class for the following:
00058         #Text:              "", # class:  '',
00059         Whitespace:                "underline #f8f8f8", # class: 'w',
00060         Error:                     "#a40000 border:#ef2929", # class: 'err',
00061         Other:                     "#000000",        # class 'x',
00062 
00063         Comment:                   "italic #8f5902", # class: 'c',
00064         Comment.Multiline:         "italic #8f5902", # class: 'cm',
00065         Comment.Preproc:           "italic #8f5902", # class: 'cp',
00066         Comment.Single:            "italic #8f5902", # class: 'c1',
00067         Comment.Special:           "italic #8f5902", # class: 'cs',
00068 
00069         Keyword:                   "bold #204a87", # class: 'k',
00070         Keyword.Constant:          "bold #204a87", # class: 'kc',
00071         Keyword.Declaration:       "bold #204a87", # class: 'kd',
00072         Keyword.Namespace:         "bold #204a87", # class: 'kn',
00073         Keyword.Pseudo:            "bold #204a87", # class: 'kp',
00074         Keyword.Reserved:          "bold #204a87", # class: 'kr',
00075         Keyword.Type:              "bold #204a87", # class: 'kt',
00076 
00077         Operator:                  "bold #ce5c00", # class: 'o'
00078         Operator.Word:             "bold #204a87", # class: 'ow' - like keywords
00079 
00080         Punctuation:               "bold #000000", # class: 'p'
00081 
00082         # because special names such as Name.Class, Name.Function, etc.
00083         # are not recognized as such later in the parsing, we choose them
00084         # to look the same as ordinary variables.
00085         Name:                          "#000000",      # class: 'n'
00086         Name.Attribute:                "#c4a000",      # class: 'na', - to be revised
00087         Name.Builtin:                  "#204a87",      # class: 'nb'
00088         Name.Builtin.Pseudo:           "#3465a4",      # class: 'bp'
00089         Name.Class:                    "#000000",      # class: 'nc' - to be revised
00090         Name.Constant:                 "#000000",      # class: 'no', - to be revised
00091         Name.Decorator:                "bold #5c35cc", # class: 'nd', - to be revised
00092         Name.Entity:                   "#ce5c00",      # class: 'ni',
00093         Name.Exception:                "bold #cc0000", # class: 'ne',
00094         Name.Function:                 "#000000",      # class: 'nf'
00095         Name.Property:                 "#000000",      # class: 'py',
00096         Name.Label:                    "#f57900",      # class: 'nl',
00097         Name.Namespace:                "#000000",      # class: 'nn' - to be revised
00098         Name.Other:                    "#000000",      # class: 'nx',
00099         Name.Tag:                      "bold #204a87", # class'nt' -- like a keyword
00100         Name.Variable:                 "#000000",      # class: 'nv', - to be revised
00101         Name.Variable.Class:           "#000000",      # class: 'vc', - to be revised
00102         Name.Variable.Global:          "#000000",      # class: 'vg', - to be revised
00103         Name.Variable.Instance:        "#000000",      # class: 'vi', - to be revised
00104 
00105         # since the tango light blue does not show up well in text, we choose
00106         # a pure blue instead.
00107         Number:                        "bold #0000cf", # class: 'm'
00108         Number.Float:                  "bold #0000cf", # class: ''mf',
00109         Number.Hex:                    "bold #0000cf", # class: ''mh',
00110         Number.Integer:                "bold #0000cf", # class: ''mi',
00111         Number.Integer.Long:           "bold #0000cf", # class: ''il',
00112         Number.Oct:                    "bold #0000cf", # class: ''mo',
00113 
00114         Literal:                   "#000000",      # class: 'l',
00115         Literal.Date:              "#000000",      # class: 'ld',
00116 
00117         String:                    "#4e9a06",      # class: 's',
00118         String.Backtick:           "#4e9a06",      # class: 'sb',
00119         String.Char:               "#4e9a06",      # class: 'sc',
00120         String.Doc:                "italic #8f5902",  # class: 'sd' - like a comment
00121         String.Double:             "#4e9a06",      # class: 's2',
00122         String.Escape:             "#4e9a06",      # class: 'se',
00123         String.Heredoc:            "#4e9a06",      # class: 'sh',
00124         String.Interpol:           "#4e9a06",      # class: 'si',
00125         String.Other:              "#4e9a06",      # class: 'sx',
00126         String.Regex:              "#4e9a06",      # class: 'sr',
00127         String.Single:             "#4e9a06",      # class: 's1',
00128         String.Symbol:             "#4e9a06",      # class: 'ss',
00129 
00130         Generic:                   "#000000",      # class: 'g',
00131         Generic.Deleted:           "#a40000",      # class: 'gd',
00132         Generic.Emph:              "italic #000000",      # class: 'ge',
00133         Generic.Error:             "#ef2929",      # class: 'gr',
00134         Generic.Heading:           "bold #000080",      # class: 'gh',
00135         Generic.Inserted:          "#00A000",      # class: 'gi',
00136         Generic.Output:            "italic #000000",      # class: 'go',
00137         Generic.Prompt:            "#8f5902",      # class: 'gp',
00138         Generic.Strong:            "bold #000000",      # class: 'gs',
00139         Generic.Subheading:        "bold #800080",      # class: 'gu',
00140         Generic.Traceback:         "bold #a40000",      # class: 'gt',
00141     }