diff --git a/butterfly/bin/btheme b/butterfly/bin/btheme
index 02ae233..d9f867b 100755
--- a/butterfly/bin/btheme
+++ b/butterfly/bin/btheme
@@ -8,7 +8,7 @@ except ImportError:
from urllib import urlopen
from io import BytesIO
-from shutil import move
+from shutil import move, rmtree
from zipfile import ZipFile
from tempfile import mkdtemp
from butterfly.escapes import sass
@@ -62,12 +62,21 @@ if args.install:
zip_dest = os.path.join(home_dir, 'butterfly-themes-master')
theme_dir = os.path.join(home_dir, 'themes')
- if os.path.exists(theme_dir):
- tmp_dir = mkdtemp()
- print('%s already present. Putting it in %s.' % (
- theme_dir, os.path.join(tmp_dir, 'themes')))
- move(theme_dir, tmp_dir)
- move(zip_dest, theme_dir)
+ if not os.path.exists(theme_dir):
+ os.makedirs(theme_dir)
+
+ tmp_dir = mkdtemp()
+ for dir_ in os.listdir(zip_dest):
+ if dir_ == 'README.md':
+ continue
+ new_dir = os.path.join(theme_dir, dir_)
+ if os.path.exists(new_dir):
+ move(new_dir, tmp_dir)
+ print('Old theme %s has been backed up in %s' % (
+ new_dir, tmp_dir))
+ move(os.path.join(zip_dest, dir_), theme_dir)
+
+ rmtree(zip_dest)
print('%s extracted.' % theme_dir)
elif args.refresh:
diff --git a/butterfly/bin/butterfly_help b/butterfly/bin/butterfly_help
index 34a0b04..190918b 100755
--- a/butterfly/bin/butterfly_help
+++ b/butterfly/bin/butterfly_help
@@ -23,38 +23,40 @@ Butterfly is a xterm compliant terminal built with python and javascript.
{title}Butterfly programs:{reset}
- {strong}bcat : {reset}A wrapper around cat allowing to display images as
instead of binary.
- {strong}bopen : {reset}Open a new terminal at specified location.
- {strong}bopen : {reset}Open or rattach a butterfly session. Multiplexing is supported.
- {strong}b16M : {reset}Test the 16M colors support in terminal.
- {strong}bhr : {reset}Put a html hr. This is a test for html output.
- {strong}bcal : {reset}Display current month using html. This is also a test for html output.
- {strong}btheme : {reset}Set a theme as current theme. (Can also install preset themes)
+ {strong}bcat : {reset}A wrapper around cat allowing to display images as
instead of binary.
+ {strong}bopen : {reset}Open a new terminal at specified location.
+ {strong}bsession : {reset}Open or rattach a butterfly session. Multiplexing is supported.
+ {strong}b16M : {reset}Test the 16M colors support in terminal.
+ {strong}bhr : {reset}Put a html hr. This is a test for html output.
+ {strong}bcal : {reset}Display current month using html. This is also a test for html output.
+ {strong}btheme : {reset}Set a theme as current theme. (Can also install preset themes)
{title}Styling butterfly:{reset}
To style butterfly in sass, you need to have the libsass python library installed.
First check out existing themes, run:
- $ btheme --install
+ {code}$ btheme --install{reset}
Then try:
- $ btheme solarized-dark # or C64 or abstract-image
- If you want to set a theme as default add a 'style=theme' line in your butterfly.conf
+ {code}$ btheme solarized-dark {comment}# or C64 or abstract-image{reset}
+ If you want to set a theme as default add a 'theme="theme"' line in your butterfly.conf
If you want to style it yourself do:
- $ cp {main} ~/.butterfly/style.sass # or /etc/butterfly/style.sass for system wide
+ {code}$ cp {main} ~/.butterfly/style.sass {comment}# or /etc/butterfly/style.sass for system wide{reset}
and then edit this file.
You can also copy the imported sass files in the same dir. Run:
- $ btheme --refresh
+ {code}$ btheme --refresh{reset}
To update the style in the current terminal.
- Finally when your theme is done please submit it to https://github.com/paradoxxxzero/butterfly-themes
+ Finally you can make a theme in the themes directory and submit it to https://github.com/paradoxxxzero/butterfly-themes
It is also possible to use a style.css file and re do all the styling in css exclusively.\
""".format(
title=ansi_colors.light_blue,
strong=ansi_colors.white,
+ code=ansi_colors.light_yellow,
+ comment=ansi_colors.light_magenta,
reset=ansi_colors.reset,
main=os.path.normpath(os.path.join(
os.path.abspath(os.path.dirname(__file__)),