diff options
author | fraoustin <fraoustin@gmail.com> | 2018-01-11 20:58:07 +0100 |
---|---|---|
committer | fraoustin <fraoustin@gmail.com> | 2018-01-11 20:58:07 +0100 |
commit | 5438d508bebc3e3e6b5d9ec008fd1e5918d891a7 (patch) | |
tree | 49f30aba94c4ef3e16806b9af0aba1a52cf036be /pgcli/pgstyle.py | |
parent | c6360191f4df5ed857bb8e0ed6cd0f306df54fcb (diff) |
add color in table and token parameter
Diffstat (limited to 'pgcli/pgstyle.py')
-rw-r--r-- | pgcli/pgstyle.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/pgcli/pgstyle.py b/pgcli/pgstyle.py index 2ff92ed1..0a6ac393 100644 --- a/pgcli/pgstyle.py +++ b/pgcli/pgstyle.py @@ -10,8 +10,12 @@ def style_factory(name, cli_style): except ClassNotFound: style = pygments.styles.get_style_by_name('native') - custom_styles = dict([(string_to_tokentype(x), y) - for x, y in cli_style.items()]) - + custom_styles = {} + for token in cli_style: + try: + custom_styles[string_to_tokentype( + token)] = style.styles[string_to_tokentype(cli_style[token])] + except AttributeError as err: + custom_styles[string_to_tokentype(token)] = cli_style[token] return PygmentsStyle.from_defaults(style_dict=custom_styles, pygments_style_cls=style) |