Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
shell script for setting gnome-terminal color palette to use Solarized theme
#!/bin/sh
#
# Shell script that configures gnome-terminal to use solarized theme
# colors. Written for Ubuntu 11.10, untested on anything else.
#
# Solarized theme: http://ethanschoonover.com/solarized
#
# Adapted from these sources:
# https://gist.github.com/1280177
# http://xorcode.com/guides/solarized-vim-eclipse-ubuntu/
case "$1" in
"dark")
PALETTE="#070736364242:#D3D301010202:#858599990000:#B5B589890000:#26268B8BD2D2:#D3D336368282:#2A2AA1A19898:#EEEEE8E8D5D5:#00002B2B3636:#CBCB4B4B1616:#58586E6E7575:#65657B7B8383:#838394949696:#6C6C7171C4C4:#9393A1A1A1A1:#FDFDF6F6E3E3"
BG_COLOR="#00002B2B3636"
FG_COLOR="#65657B7B8383"
;;
"light")
PALETTE="#EEEEE8E8D5D5:#D3D301010202:#858599990000:#B5B589890000:#26268B8BD2D2:#D3D336368282:#2A2AA1A19898:#070736364242:#FDFDF6F6E3E3:#CBCB4B4B1616:#9393A1A1A1A1:#838394949696:#65657B7B8383:#6C6C7171C4C4:#58586E6E7575:#00002B2B3636"
BG_COLOR="#FDFDF6F6E3E3"
FG_COLOR="#838394949696"
;;
*)
echo "Usage: solarize [light | dark]"
exit
;;
esac
gconftool-2 --set "/apps/gnome-terminal/profiles/Default/use_theme_background" --type bool false
gconftool-2 --set "/apps/gnome-terminal/profiles/Default/use_theme_colors" --type bool false
gconftool-2 --set "/apps/gnome-terminal/profiles/Default/palette" --type string "$PALETTE"
gconftool-2 --set "/apps/gnome-terminal/profiles/Default/background_color" --type string "$BG_COLOR"
gconftool-2 --set "/apps/gnome-terminal/profiles/Default/foreground_color" --type string "$FG_COLOR"
@Xeoncross

This comment has been minimized.

Copy link

commented Oct 4, 2012

Before running this script please make a new copy of your current terminal profile in the "Edit" -> "Profiles" menu in case you want to switch back later. To use this script, paste this file into your home folder as solarize.sh and then run chmod +x solarize.sh.

$ ./solarize.sh light
@jaywilliams

This comment has been minimized.

Copy link

commented Feb 15, 2013

Here is a tip for Mate users:

To make this work, replace gconftool-2 with mateconftool-2, and gnome-terminal with mate-terminal.

@variousauthors

This comment has been minimized.

Copy link

commented Aug 9, 2013

Hmm... For some reason my terminal is still using a strange dark grey for the numbered sidebar, rather than the attractive light grey-blue that I see in this screenshot.

@maksadbek

This comment has been minimized.

Copy link

commented Aug 19, 2013

Hej man, thank you :)

@njuaplusplus

This comment has been minimized.

Copy link

commented Aug 23, 2013

Thank you!

@sgsheg

This comment has been minimized.

Copy link

commented Jul 3, 2014

Thank you!

@eduncan911

This comment has been minimized.

Copy link

commented Sep 15, 2014

Yes, perfect.
Debian Testing + i3 w/downgraded gnome-terminal 3.6

@andykais

This comment has been minimized.

Copy link

commented Jul 4, 2015

this works great for everything except my PS1 colors, it distorts them
PS1='$(if [ $? -eq 0 ]; then echo "\[\033[32m\]:)"; else echo "\[\033[31m\]:("; fi) ${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u : \[\033[01;34m\]$(echo $(pwd) | grep -o "/" | wc -l)/$(basename $(pwd))\[\033[00m\] - '

Greens are grey and blue is darker blue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.