Notes

The Ultimate Guide to creating a Gnome Terminal theme

Edit on GitHub

Ubuntu
5 minutes
1sudo apt-get install dconf-cli uuid-runtime
2bash -c "$(curl -fsSL https://raw.githubusercontent.com/denysdovhan/gnome-terminal-one/master/one-dark.sh)"

GConf, DConf and GSettings

Gnome Terminal color palette details originally used to be stored in ~/.gconf/apps/gnome-terminal/profiles/ and %gconf.xml had all palette related data. But on recent Ubuntu (20.04) you’ll find ~/.gconf to be completely empty even if you have multiple Terminal profiles saved.

That’s because of the transition from GConf (for storing user preferences) to the combination of the GSettings high-level configuration system and the DConf back end. Updating gsettings is preferred over directly writing to dconf

As of version 3.7.0, gnome-terminal uses GSettings and DConf instead of GConf. If you want your theme to be backwards comaptible, you gotta add configuration for both.

Since dconf is a database saved in binary format, you can’t just read the files as is. What you can do is dump it

1dconf dump /org/gnome/terminal/ > gnome_terminal_settings_backup.txt

Now you have the backup for all Terminal profiles in human-readable format. The entire dconf database is stored in ~/.config/dconf/user, which you can backup with

1dconf dump /org/gnome/terminal/ > gnome_terminal_settings_backup.txt

Here’s a backup of the theme Nord which gives me all keys and values. Neat!

 1[legacy/profiles:/:6eb7e206-f8f1-4f38-84bb-9dfbfec8e8f6]
 2background-color='#2E3440'
 3bold-color='#D8DEE9'
 4bold-color-same-as-fg=true
 5cursor-background-color='rgb(216,222,233)'
 6cursor-colors-set=true
 7cursor-foreground-color='rgb(59,66,82)'
 8foreground-color='#D8DEE9'
 9highlight-background-color='rgb(136,192,208)'
10highlight-colors-set=true
11highlight-foreground-color='rgb(46,52,64)'
12nord-gnome-terminal-version='0.1.0'
13palette=['#3B4252', '#BF616A', '#A3BE8C', '#EBCB8B', '#81A1C1', '#B48EAD', '#88C0D0', '#E5E9F0', '#4C566A', '#BF616A', '#A3BE8C', '#EBCB8B', '#81A1C1', '#B48EAD', '#8FBCBB', '#ECEFF4']
14use-theme-background=false
15use-theme-colors=false
16use-theme-transparency=false
17use-transparent-background=false
18visible-name='Nord'

Loading settings form backup

backup:

1dconf dump /org/gnome/terminal/ > gnome_terminal_settings_backup.txt

reset the settings before restore (optional):

1dconf reset -f /org/gnome/terminal/

restore:

1dconf load /org/gnome/terminal/ < gnome_terminal_settings_backup.txt

dconf GUI

You can use a GUI to edit the dconf configuration database

1sudo apt install dconf-editor
2dconf-editor

Gnome terminal related settings are in

/org/gnome/terminal

Profiles are in

/org/gnome/terminal/legacy/profiles

You can actually go in and edit all your theme settings directly there..

See all profiles installed

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

Find profile ID

You can get the ID for the default profile with

1gsettings get org.gnome.Terminal.ProfilesList default

You can also see the Profile ID mentioned in bottom right of the window under Preferences > THEME_NAME > Text

Switching themes

Once you have your theme installed, click on the down arrow in top right to see the dropdown for themes..

Some good themes

Nord

1git clone https://github.com/arcticicestudio/nord-gnome-terminal.git
2cd nord-gnome-terminal/src
3./nord.sh

One Dark

1bash -c "$(curl -fsSL https://raw.githubusercontent.com/denysdovhan/gnome-terminal-one/master/one-dark.sh)"

Gogh has almost 200 versions of the theme

1bash -c  "$(wget -qO- https://git.io/vQgMr)"

Creating a theme

See all possible keys you can set for a Profile

1UUID=$(gsettings get org.gnome.Terminal.ProfilesList default | tr -d \')
2gsettings list-keys org.gnome.Terminal.Legacy.Profile:/$UUID/
foreground-color
highlight-foreground-color
word-char-exceptions
audible-bell
palette
encoding
bold-color-same-as-fg
login-shell
default-size-rows
cursor-blink-mode
cursor-colors-set
cursor-background-color
enable-bidi
use-transparent-background
scrollbar-policy
use-system-font
bold-color
cursor-foreground-color
visible-name
custom-command
scrollback-unlimited
font
use-theme-transparency
cjk-utf8-ambiguous-width
cursor-shape
use-custom-command
exit-action
bold-is-bright
scroll-on-output
highlight-colors-set
delete-binding
preserve-working-directory
backspace-binding
background-transparency-percent
cell-height-scale
use-theme-colors
background-color
highlight-background-color
enable-shaping
default-size-columns
cell-width-scale
scroll-on-keystroke
rewrap-on-resize
scrollback-lines
text-blink-mode

If you do list-recursively, you can see the keys as well as their current values

1gsettings list-recursively org.gnome.Terminal.Legacy.Profile:/$UUID/
 1org.gnome.Terminal.Legacy.Profile foreground-color '#D3D7CF'
 2org.gnome.Terminal.Legacy.Profile highlight-foreground-color '#ffffff'
 3org.gnome.Terminal.Legacy.Profile word-char-exceptions @ms nothing
 4org.gnome.Terminal.Legacy.Profile audible-bell true
 5org.gnome.Terminal.Legacy.Profile palette ['#2E3436', '#CC0000', '#4E9A06', '#C4A000', '#3465A4', '#75507B', '#06989A', '#D3D7CF', '#555753', '#EF2929', '#8AE234', '#FCE94F', '#729FCF', '#AD7FA8', '#34E2E2', '#EEEEEC']
 6org.gnome.Terminal.Legacy.Profile encoding 'UTF-8'
 7org.gnome.Terminal.Legacy.Profile bold-color-same-as-fg true
 8org.gnome.Terminal.Legacy.Profile login-shell false
 9org.gnome.Terminal.Legacy.Profile default-size-rows 24
10org.gnome.Terminal.Legacy.Profile cursor-blink-mode 'system'
11org.gnome.Terminal.Legacy.Profile cursor-colors-set false
12org.gnome.Terminal.Legacy.Profile cursor-background-color '#000000'
13org.gnome.Terminal.Legacy.Profile enable-bidi true
14org.gnome.Terminal.Legacy.Profile use-transparent-background false
15org.gnome.Terminal.Legacy.Profile scrollbar-policy 'always'
16org.gnome.Terminal.Legacy.Profile use-system-font true
17org.gnome.Terminal.Legacy.Profile bold-color '#000000'
18org.gnome.Terminal.Legacy.Profile cursor-foreground-color '#ffffff'
19org.gnome.Terminal.Legacy.Profile visible-name 'Unnamed'
20org.gnome.Terminal.Legacy.Profile custom-command ''
21org.gnome.Terminal.Legacy.Profile scrollback-unlimited false
22org.gnome.Terminal.Legacy.Profile font 'Monospace 12'
23org.gnome.Terminal.Legacy.Profile use-theme-transparency true
24org.gnome.Terminal.Legacy.Profile cjk-utf8-ambiguous-width 'narrow'
25org.gnome.Terminal.Legacy.Profile cursor-shape 'block'
26org.gnome.Terminal.Legacy.Profile use-custom-command false
27org.gnome.Terminal.Legacy.Profile exit-action 'close'
28org.gnome.Terminal.Legacy.Profile bold-is-bright false
29org.gnome.Terminal.Legacy.Profile scroll-on-output false
30org.gnome.Terminal.Legacy.Profile highlight-colors-set false
31org.gnome.Terminal.Legacy.Profile delete-binding 'delete-sequence'
32org.gnome.Terminal.Legacy.Profile preserve-working-directory 'safe'
33org.gnome.Terminal.Legacy.Profile backspace-binding 'ascii-delete'
34org.gnome.Terminal.Legacy.Profile background-transparency-percent 50
35org.gnome.Terminal.Legacy.Profile cell-height-scale 1.0
36org.gnome.Terminal.Legacy.Profile use-theme-colors true
37org.gnome.Terminal.Legacy.Profile background-color '#2E3436'
38org.gnome.Terminal.Legacy.Profile highlight-background-color '#000000'
39org.gnome.Terminal.Legacy.Profile enable-shaping true
40org.gnome.Terminal.Legacy.Profile default-size-columns 80
41org.gnome.Terminal.Legacy.Profile cell-width-scale 1.0
42org.gnome.Terminal.Legacy.Profile scroll-on-keystroke true
43org.gnome.Terminal.Legacy.Profile rewrap-on-resize true
44org.gnome.Terminal.Legacy.Profile scrollback-lines 10000
45org.gnome.Terminal.Legacy.Profile text-blink-mode 'always'

changing theme values

You can either use dconf write or gsettings set to change these values

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

Color palettes

A palette is the bare minimum you need.

1dconf write /org/gnome/terminal/legacy/profiles:/PROFILE_UUIS/palette "['rgb(0,0,0)', 'rgb(204,0,0)', 'rgb(78,154,6)', 'rgb(196,160,0)', 'rgb(52,101,164)', 'rgb(117,80,123)', 'rgb(6,152,154)', 'rgb(211,215,207)', 'rgb(85,87,83)', 'rgb(239,41,41)', 'rgb(138,226,52)', 'rgb(252,233,79)', 'rgb(114,159,207)', 'rgb(173,127,168)', 'rgb(52,226,226)', 'rgb(238,238,236)']"

I need 16 colors roughly to create a profile. Colors can be both HEX #88C0D0 and RGB rgb(136,192,208)

['#2E3436', '#CC0000', '#4E9A06', '#C4A000', '#3465A4', '#75507B', '#06989A', '#D3D7CF', '#555753', '#EF2929', '#8AE234', '#FCE94F', '#729FCF', '#AD7FA8', '#34E2E2', '#EEEEEC']
['rgb(179,177,173)', 'rgb(10,14,20)', 'rgb(0,1,10)', 'rgb(196,160,0)', 'rgb(52,101,164)', 'rgb(117,80,123)', 'rgb(6,152,154)', 'rgb(211,215,207)', 'rgb(85,87,83)', 'rgb(239,41,41)', 'rgb(138,226,52)', 'rgb(252,233,79)', 'rgb(114,159,207)', 'rgb(173,127,168)', 'rgb(52,226,226)', 'rgb(238,238,236)']
 1# Ayu Dark
 2['#00010a',
 3'#ea6c73',
 4'#91b362',
 5'#f9af4f',
 6'#53bdfa',
 7'#fae994',
 8'#90e1c6',
 9'#c7c7c7',
10'#686868',
11'#f07178',
12'#c2d94c',
13'#ffb454',
14'#59c2ff',
15'#ffee99',
16'#95e6cb',
17'#ffffff']

There are two ways of creating a theme. One is to do it manually by hand via the GUIs (dconf-editor and Terminal > Prefernces > Profile). The other is writing a script (using dconf-cli) so that anyone can use a one-liner to install the theme.

Generating Profile ID

Get a unique profile ID with the uuidgen command

1# suo apt install uuid-runtime
2uuidgen
11918da06-514a-4b10-bdd1-c4d8cea263c5

Scripts