Ubuntu – How to set the gnome-terminal color scheme to “Solarized Dark” via commandline

17.04command linegnome-terminal

In Ubuntu 17.04 the gnome-terminal uses 'colors from system theme'

enter image description here

I am looking for a bash/script way to modify this, I'd like to have gnome-terminal use the Solarized Theme. That means, uncheck the 'use colors from system them' and pick Solarized Dark from the build-in schemes.

enter image description here

I'm able to list out the possible keys that can be get/set:

UUID=$(gsettings get org.gnome.Terminal.ProfilesList default | tr -d \')
gsettings list-keys org.gnome.Terminal.Legacy.Profile:/$UUID/

And here's the list I get, but I can't figure out which one of these to set to get Solarized Dark.

audible-bell
cursor-shape
scroll-on-keystroke
cursor-colors-set
cjk-utf8-ambiguous-width
default-size-rows
encoding
use-theme-colors
custom-command
visible-name
login-shell
exit-action
use-system-font
rewrap-on-resize
backspace-binding
foreground-color
bold-color-same-as-fg
background-transparency-percent
cursor-blink-mode
default-show-menubar
default-size-columns
background-color
palette
cursor-foreground-color
allow-bold
use-theme-transparency
highlight-foreground-color
font
delete-binding
scrollback-unlimited
use-transparent-background
cursor-background-color
highlight-background-color
scroll-on-output
scrollbar-policy
use-custom-command
bold-color
highlight-colors-set
scrollback-lines
word-char-exceptions

I tried setting this to true/false, but it has made no difference

gsettings set org.gnome.Terminal.Legacy.Profile:/$UUID/ use-theme-colors false

Best Answer

Also I can't find that something like Solarized Dark in gsettings or dconf.

Method1:

But according to this answer, we can find Solarized Dark RGB parameters, and set gnome-terminal colors to that parameters.

You can do this with dconf-cli:

sudo apt install dconf-cli

And then find your profile id with this command:

dconf list /org/gnome/terminal/legacy/profiles:/

That can be something like this:

:b1dcc9dd-5262-4d8d-a863-c897e6d979b9/

And set this values on gnome-terminal to make your desired theme.

dconf write /org/gnome/terminal/legacy/profiles:/<profile id>use-theme-colors "false"
dconf write /org/gnome/terminal/legacy/profiles:/<profile id>background-color "'rgb(0,43,54)'"
dconf write /org/gnome/terminal/legacy/profiles:/<profile id>foreground-color "'rgb(131,148,150)'"

For example:

dconf write /org/gnome/terminal/legacy/profiles:/:b1dcc9dd-5262-4d8d-a863-c897e6d979b9/use-theme-colors "false"
dconf write /org/gnome/terminal/legacy/profiles:/:b1dcc9dd-5262-4d8d-a863-c897e6d979b9/background-color "'rgb(0,43,54)'"
dconf write /org/gnome/terminal/legacy/profiles:/:b1dcc9dd-5262-4d8d-a863-c897e6d979b9/foreground-color "'rgb(131,148,150)'"

Method2:

Also you can do this with gsettings:

gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:b1dcc9dd-5262-4d8d-a863-c897e6d979b9/ use-theme-colors false    
gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:b1dcc9dd-5262-4d8d-a863-c897e6d979b9/ background-color 'rgb(0,43,54)'
gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:b1dcc9dd-5262-4d8d-a863-c897e6d979b9/ foreground-color 'rgb(131,148,150)'

That b1dcc9dd-5262-4d8d-a863-c897e6d979b9 is my profile id and you can find yours with this command:

gsettings get org.gnome.Terminal.ProfilesList default