Archive

Posts Tagged ‘light background’

bpython config file for light background

August 14, 2013 6 comments

Problem
The default color scheme of bpython is designed for dark background. If you launch bpython with light background, it’s almost unreadable. Is there a color scheme for light background?

Solution
Create the dir ~/.bpython and add the following files:

~/.bpython/config:

# This is a standard python config file
# Valid values can be True, False, integer numbers, strings
# By default bpython will look for ~/.bpython/config or you can specify a file
# with the -c option on the command line

# General section tag
[general]

# Display the autocomplete list as you type (default: True).
# When this is off, you can hit tab to see the suggestions.
auto_display_list = True

# Syntax highlighting as you type (default: True).
syntax = True

# Display the arg spec (list of arguments) for callables,
# when possible (default: True).
arg_spec = True

# History file (default: ~/.pythonhist):
hist_file = ~/.pythonhist

# Number of lines to store in history (set to 0 to disable) (default: 100):
hist_len = 100

# Soft tab size (default: 4, see pep-8):
tab_length = 4

# Color schemes should be put in ~/.bpython/
# e.g. to use the theme ~/.bpython/foo.theme set color_scheme = foo
# Leave blank or set to "default" to use the default theme
#color_scheme = default
color_scheme = jabba

[keyboard]
pastebin = F8
save = C-s

~/.bpython/jabba.theme (derived from light.theme):

# Each letter represents a colour marker:
#   k, r, g, y, b, m, c, w, d
# which stands for:
#   blacK, Red, Green, Yellow, Blue, Magenta, Cyan, White, Default
# Capital letters represent bold
# Copy to ~/.bpython/foo.theme and set "color_scheme = foo" in
# ~/.bpython/config

[syntax]
keyword = B
name = r
comment = b
string = g
error = r
number = B
operator = b
paren = b
punctuation = b
token = g

[interface]
# XXX: gnome-terminal appears to be braindead. The cursor will disappear unless
# you set the background colour to "d".
background = d
output = b
main = b
prompt = b
prompt_more = g

Screenshot
bpy

Update (20160214)
As it was pointed out by Leonardo in a comment (thanks!), “you need to put the configuration files inside ~/.config/bpython instead of ~/.bpython.” Yeah, applications in newer Linux versions prefer the ~/.config folder.