Repository: httpie/httpie
File: httpie/output/formatters/colors.py (Python)

Code before:

    def format_value(value):
        return " ".join(
            get_shade(part)
            for part in value.split()
        )

    return {
        key: format_value(value)
        for key, value in raw_styles.items()
    }


def make_styles(name, raw_styles):
    for mode, shade in [
        ('light', '700'),
        ('universal', '600'),
        ('dark', '500')
    ]:
        yield type(
            name.format(mode=mode.title()),
            (pygments.style.Style,),
            {
                'styles': format_style(raw_styles, shade)
            }
        )


PieLightHeaderStyle, PieUniversalHeaderStyle, PieDarkHeaderStyle = make_styles(
    'Pie{mode}HeaderStyle',
    {
        # HTTP line / Headers / Etc.
        pygments.token.Name.Namespace: 'bold primary',
        pygments.token.Keyword.Reserved: 'bold grey',
        pygments.token.Operator: 'bold grey',
        pygments.token.Number: 'bold grey',
        pygments.token.Name.Function.Magic: 'bold green',
        pygments.token.Name.Exception: 'bold green',
        pygments.token.Name.Attribute: 'blue',
        pygments.token.String: 'primary',

        # HTTP Methods
        pygments.token.Name.Function: 'bold grey',
        pygments.token.Name.Function.HTTP.GET: 'bold green',
        pygments.token.Name.Function.HTTP.HEAD: 'bold green',
        pygments.token.Name.Function.HTTP.POST: 'bold yellow',
        pygments.token.Name.Function.HTTP.PUT: 'bold orange',
        pygments.token.Name.Function.HTTP.PATCH: 'bold orange',
        pygments.token.Name.Function.HTTP.DELETE: 'bold red',

        # HTTP status codes

Review comment (suggestion):
These are tied to the Pie themes, so I’d either reflect that in their names or move them to `palette`.

Code after:
    pygments.token.Name.Function.HTTP.DELETE: 'bold red',

    # HTTP status codes
    pygments.token.Number.HTTP.INFO: 'bold aqua',
    pygments.token.Number.HTTP.OK: 'bold green',
    pygments.token.Number.HTTP.REDIRECT: 'bold yellow',
    pygments.token.Number.HTTP.CLIENT_ERR: 'bold orange',
    pygments.token.Number.HTTP.SERVER_ERR: 'bold red',
}

PIE_BODY_STYLE = {
    # {}[]:
    pygments.token.Punctuation: 'grey',

    # Keys
    pygments.token.Name.Tag: 'pink',

    # Values
    pygments.token.Literal.String: 'green',
    pygments.token.Literal.String.Double: 'green',
    pygments.token.Literal.Number: 'aqua',
    pygments.token.Keyword: 'orange',

    # Other stuff
    pygments.token.Text: 'primary',
    pygments.token.Name.Attribute: 'primary',
    pygments.token.Name.Builtin: 'blue',
    pygments.token.Name.Builtin.Pseudo: 'blue',
    pygments.token.Name.Class: 'blue',
    pygments.token.Name.Constant: 'orange',
    pygments.token.Name.Decorator: 'blue',
    pygments.token.Name.Entity: 'orange',
    pygments.token.Name.Exception: 'yellow',
    pygments.token.Name.Function: 'blue',
    pygments.token.Name.Variable: 'blue',
    pygments.token.String: 'aqua',
    pygments.token.String.Backtick: 'secondary',
    pygments.token.String.Char: 'aqua',
    pygments.token.String.Doc: 'aqua',
    pygments.token.String.Escape: 'red',
    pygments.token.String.Heredoc: 'aqua',
    pygments.token.String.Regex: 'red',
    pygments.token.Number: 'aqua',
    pygments.token.Operator: 'primary',
    pygments.token.Operator.Word: 'green',
    pygments.token.Comment: 'secondary',
    pygments.token.Comment.Preproc: 'green',
    pygments.token.Comment.Special: 'green',
    pygments.token.Generic.Deleted: 'aqua',
    pygments.token.Generic.Emph: 'italic',
    pygments.token.Generic.Error: 'red',