from pygments.style import Style
from pygments.token import (
    Comment, Error, Keyword, Literal, Name, Number, Operator, String, Text
)


class Base16Style(Style):
    base00 = '#{{base00-hex}}'
    base01 = '#{{base01-hex}}'
    base02 = '#{{base02-hex}}'
    base03 = '#{{base03-hex}}'
    base04 = '#{{base04-hex}}'
    base05 = '#{{base05-hex}}'
    base06 = '#{{base06-hex}}'
    base07 = '#{{base07-hex}}'
    base08 = '#{{base08-hex}}'
    base09 = '#{{base09-hex}}'
    base0a = '#{{base0A-hex}}'
    base0b = '#{{base0B-hex}}'
    base0c = '#{{base0C-hex}}'
    base0d = '#{{base0D-hex}}'
    base0e = '#{{base0E-hex}}'
    base0f = '#{{base0F-hex}}'

    default_style = ''

    background_color = base00
    highlight_color = base02

    styles = {
        Text: base05,
        Error: base08,  # .err

        Comment: base03,  # .c
        Comment.Preproc: base0f,  # .cp
        Comment.PreprocFile: base0b,  # .cpf

        Keyword: base0e,  # .k
        Keyword.Type: base08,  # .kt

        Name.Attribute: base0d,  # .na
        Name.Builtin: base0d,  # .nb
        Name.Builtin.Pseudo: base08,  # .bp
        Name.Class: base0d,  # .nc
        Name.Constant: base09,  # .no
        Name.Decorator: base09,  # .nd
        Name.Function: base0d,  # .nf
        Name.Namespace: base0d,  # .nn
        Name.Tag: base0e,  # .nt
        Name.Variable: base0d,  # .nv
        Name.Variable.Instance: base08,  # .vi

        Number: base09,  # .m

        Operator: base0c,  # .o
        Operator.Word: base0e,  # .ow

        Literal: base0b,  # .l

        String: base0b,  # .s
        String.Interpol: base0f,  # .si
        String.Regex: base0c,  # .sr
        String.Symbol: base09,  # .ss
    }


from string import capwords  # noqa: E402
Base16Style.__name__ = 'Base16{}Style'.format(
    capwords('{{scheme-slug}}', '-').replace('-', '')
)
globals()[Base16Style.__name__] = globals()['Base16Style']
del globals()['Base16Style']
del capwords
