Created
August 2, 2015 18:10
-
-
Save amjith/6825dc9693120db529e5 to your computer and use it in GitHub Desktop.
PGStyle with adjustable colors
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pygments.token import Token | |
from pygments.style import Style | |
from pygments.util import ClassNotFound | |
from prompt_toolkit.styles import default_style_extensions | |
import pygments.styles | |
def style_factory(name, completion_selected_color, completion_unselected_color): | |
try: | |
style = pygments.styles.get_style_by_name(name) | |
except ClassNotFound: | |
style = pygments.styles.get_style_by_name('native') | |
class PGStyle(Style): | |
styles = {} | |
styles.update(style.styles) | |
styles.update(default_style_extensions) | |
styles.update({ | |
Token.Menu.Completions.Completion.Current: '%s' % completion_selected_color, | |
Token.Menu.Completions.Completion: '%s' % completion_unselected_color, | |
Token.Menu.Completions.Meta.Current: 'bg:#44aaaa #000000', | |
Token.Menu.Completions.Meta: 'bg:#448888 #ffffff', | |
Token.Menu.Completions.ProgressButton: 'bg:#003333', | |
Token.Menu.Completions.ProgressBar: 'bg:#00aaaa', | |
Token.SelectedText: '#ffffff bg:#6666aa', | |
Token.IncrementalSearchMatch: '#ffffff bg:#4444aa', | |
Token.IncrementalSearchMatch.Current: '#ffffff bg:#44aa44', | |
Token.Toolbar: 'bg:#440044 #ffffff', | |
Token.Toolbar: 'bg:#222222 #aaaaaa', | |
Token.Toolbar.Off: 'bg:#222222 #888888', | |
Token.Toolbar.On: 'bg:#222222 #ffffff', | |
}) | |
return PGStyle |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment