Skip to content

Instantly share code, notes, and snippets.

@itorres
Created August 6, 2013 16:41
Show Gist options
  • Save itorres/6166221 to your computer and use it in GitHub Desktop.
Save itorres/6166221 to your computer and use it in GitHub Desktop.
Configure Solarized (http://ethanschoonover.com/solarized) in Gnome Terminal 3.8
#!/usr/bin/env ruby
#
# Configure Solarized (http://ethanschoonover.com/solarized) in
# Gnome Terminal 3.8
#
# Hacked away in a lazy summer afternoon by http://ignacio.torresmasdeu.name/
profile_dir="/org/gnome/terminal/legacy/profiles"
default_profile=`gsettings get org.gnome.Terminal.ProfilesList default`.strip.delete("'")
s = {
:base03 => '#00002B2B3636',
:base02 => '#070736364242',
:base01 => '#58586e6e7575',
:base00 => '#65657b7b8383',
:base0 => '#838394949696',
:base1 => '#9393a1a1a1a1',
:base2 => '#EEEEE8E8D5D5',
:base3 => '#fdfdf6f6e3e3',
:yellow => '#B5B589890000',
:orange => '#CBCB4B4B1616',
:red => '#DCDC32322F2F',
:magenta => '#D3D336368282',
:violet => '#6C6C7171C4C4',
:blue => '#26268B8BD2D2',
:cyan => '#2A2AA1A19898',
:green => '#858599990000',
}
themes = {
:dark => {
:bg => s[:base03],
:fg => s[:base0],
:bd => s[:base1],
:p => [
s[:base02],
s[:red],
s[:green],
s[:yellow],
s[:blue],
s[:magenta],
s[:cyan],
s[:base2],
s[:base03],
s[:orange],
s[:base01],
s[:base00],
s[:base0],
s[:violet],
s[:base1],
s[:base3],
]
},
:light => {
:bg => s[:base3],
:fg => s[:base00],
:bd => s[:base01],
:p => [
s[:base2],
s[:red],
s[:green],
s[:yellow],
s[:blue],
s[:magenta],
s[:cyan],
s[:base02],
s[:base3],
s[:orange],
s[:base1],
s[:base0],
s[:base00],
s[:violet],
s[:base01],
s[:base03],
]
},
}
theme=ARGV.shift
if theme==nil or not themes.has_key?(theme.intern)
puts "Usage: " << __FILE__ << " <dark|light>"
exit
end
theme=theme.intern
palette=%Q([#{ themes[theme][:p].map { |c| %Q('#{c}') }.join(',') }])
profile_path="#{profile_dir}:/:#{default_profile}"
keys = [
%Q(dconf write #{profile_path}/bold-color "'#{themes[theme][:bd]}'"),
%Q(dconf write #{profile_path}/background-color "'#{themes[theme][:bg]}'"),
%Q(dconf write #{profile_path}/foreground-color "'#{themes[theme][:fg]}'"),
%Q(dconf write #{profile_path}/palette "#{palette}"),
%Q(dconf write #{profile_path}/use-theme-colors "false"),
%Q(dconf write #{profile_path}/bold-color-same-as-fg "false"),
%Q(dconf write #{profile_path}/use-system-font "false"),
%Q(dconf write #{profile_path}/font "'Liberation Mono 8'")
]
keys.each {|k|
puts k if ENV['DEBUG']
%x(#{k})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment