Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Zenburn color scheme for gnome-terminal
#!/usr/bin/env bash
dir=$(dirname $0)
gconfdir=/apps/gnome-terminal/profiles
echo # This makes the prompts easier to follow (as do other random echos below)
########################
### Select a profile ###
########################
declare -a profiles
declare -a visnames
profiles=($(gconftool-2 -R $gconfdir | grep $gconfdir | cut -d/ -f5 | cut -d: -f1))
#get visible names
for index in ${!profiles[@]};
do
visnames[$index]=$(gconftool-2 -g $gconfdir/${profiles[$index]}/visible_name);
done
echo "Please select a Gnome Terminal profile:"
IFS=','
names="${visnames[*]}"
select profile_name in $names;
do
if [[ -z $profile_name ]]; then
echo -e "ERROR: Invalid selection -- ABORTING!\n"
exit 1
fi
break;
done
profile_key=$(expr ${REPLY} - 1)
unset IFS
#########################################################
### Show the choices made and prompt for confirmation ###
#########################################################
echo "You have selected:"
echo -e " Profile: $profile_name (gconf key: ${profiles[$profile_key]})\n"
#typeset -u confirmation
echo -n "Is this correct? (YES to continue) "
read confirmation
confirmation=$(echo $confirmation | tr '[:lower:]' '[:upper:]')
if [[ $confirmation != YES ]]; then
echo -e "ERROR: Confirmation failed -- ABORTING!\n"
exit 3
fi
########################
### Finally... do it ###
########################
echo -e "Confirmation received -- applying settings\n"
profile_path=$gconfdir/${profiles[$profile_key]}
# set palette
gconftool-2 -s -t string $profile_path/palette "#3F3F3F3F3F3F:#CCCC93939393:#7F7F9F9F7F7F:#E3E3CECEABAB:#DFDFAFAF8F8F:#CCCC93939393:#8C8CD0D0D3D3:#DCDCDCDCCCCC:#3F3F3F3F3F3F:#CCCC93939393:#7F7F9F9F7F7F:#E3E3CECEABAB:#DFDFAFAF8F8F:#CCCC93939393:#8C8CD0D0D3D3:#DCDCDCDCCCCC"
# set highlighted color to be different from foreground-color
gconftool-2 -s -t bool $profile_path/bold_color_same_as_fg false
# set foreground, background and highlight color
gconftool-2 -s -t string $profile_path/background_color "#3F3F3F3F3F3F"
gconftool-2 -s -t string $profile_path/foreground_color "#DCDCDCDCCCCC"
gconftool-2 -s -t string $profile_path/bold_color "#E3E3CECEABAB"
# make sure the profile is set to not use theme colors
gconftool-2 -s -t bool $profile_path/use_theme_colors false
@jnfbatista

This comment has been minimized.

Copy link

commented Mar 7, 2013

My eyes (and my laziness) thank you!

@tutysara

This comment has been minimized.

Copy link

commented Mar 21, 2013

thx, my screen looks nice

@KurtG

This comment has been minimized.

Copy link

commented Jul 5, 2013

Nice!

@dorvak

This comment has been minimized.

Copy link

commented Aug 12, 2013

Error giving:

Please select a Gnome Terminal profile:
expr: syntax error
You have selected:
  Profile:  (gconf key: )

Is this correct? (YES to continue) yes
Confirmation received -- applying settings

Error setting value: Bad key or directory name: "/apps/gnome-terminal/profiles//palette": Can't have two slashes '/' in a row
Error setting value: Bad key or directory name: "/apps/gnome-terminal/profiles//bold_color_same_as_fg": Can't have two slashes '/' in a row
Error setting value: Bad key or directory name: "/apps/gnome-terminal/profiles//background_color": Can't have two slashes '/' in a row
Error setting value: Bad key or directory name: "/apps/gnome-terminal/profiles//foreground_color": Can't have two slashes '/' in a row
Error setting value: Bad key or directory name: "/apps/gnome-terminal/profiles//bold_color": Can't have two slashes '/' in a row
Error setting value: Bad key or directory name: "/apps/gnome-terminal/profiles//use_theme_colors": Can't have two slashes '/' in a row
@jacobemcken

This comment has been minimized.

Copy link

commented Oct 16, 2013

If you wonder why this doesn't work (you apply the thing and nothing changes).

It's probably because you version of gnome-terminal uses dconf instead of gconf.

@mijoharas

This comment has been minimized.

Copy link

commented Apr 24, 2014

This does not work for me, won't display any profiles. similar error to above @dorvak

@gnumoksha

This comment has been minimized.

Copy link

commented Aug 30, 2014

I have fixed and implemented this color scheme in https://github.com/gnumoksha/gnome-terminal-colors

@LastDreamer

This comment has been minimized.

Copy link

commented Aug 11, 2015

Thank you!

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.