How to export / import Ubuntu 16.04 terminal color scheme

5,614

Im assuming you mean the profile of Gnome terminal, i.e., the color and size of the fonts in the terminal, background color etc, and not the styling of the GTK window and widgets of the terminal itself.
In Ubuntu 16.04 the GTK version has switched to 3, so gconftool-2 won't work any more, you need to use gsettings.
heres the bash script I use to recreate my gnome-terminal profile on Ubuntu 16.04:

user=YOUR_USERNAME_GOES_HERE

sudo -u $user bash << EOF || exit 1
    # working with gsettings
    #--------------------------
    # 
    # Getting a dump of the new settings
    # 
    # get a list of schemas - so that the schema can be fed into gsettings list-keys
    #
    #     gsettings list-relocatable-schemas | grep -i terminal
    #
    # produces
    # org.gnome.Terminal.SettingsList
    # org.gnome.Terminal.Legacy.Profile
    # org.gnome.Terminal.Legacy.Keybindings
    # 
    # taking "schema" org.gnome.Terminal.Legacy.Profile, produce a list of keys
    #     gsettings list-keys org.gnome.Terminal.Legacy.Profile
    # 
    # get UUID of default profile
    # there is some info on this here:
    # https://wiki.gnome.org/Apps/Terminal/FAQ#How_can_I_change_a_profile_setting_from_the_command_line.3F
    profile=$(gsettings get org.gnome.Terminal.ProfilesList default)
    profile=${profile:1:-1} # remove leading and trailing single quotes

    # getting/dumping values
    #-----------
    # gsettings get \
    #   org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:${profile}/ \
    #   background-transparency-percent


    gsettings set \
        org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:${profile}/ \
        use-theme-colors false

    gsettings set \
        org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:${profile}/ \
        background-color "#393939"

    gsettings set \
        org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:${profile}/ \
        scrollback-unlimited true

    gsettings set \
        org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:${profile}/ \
        foreground-color "#eee"

    gsettings set \
        org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:${profile}/ \
        use-transparent-background true

    gsettings set \
        org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:${profile}/ \
        background-transparency-percent "10"
EOF

These are my preferences, I would recommend installing dconf-editor to locate the appropriate keys that need to be modified to get your own preferences.

Share:
5,614
Mankind1023
Author by

Mankind1023

Updated on September 18, 2022

Comments

  • Mankind1023
    Mankind1023 over 1 year

    I'm trying to export the color scheme from my Ubuntu 16.04 terminal to use on another system.

    I found some posts that suggest:

    gconftool-2 --dump '/apps/gnome-terminal' > gnome-terminal-conf.xml
    

    ... but that no longer works. I also found someone suggesting using terminal.sexy, but I'm looking for a way to do this through Ubuntu terminal or some other tool I can use locally.