Ubuntu – How to add custom color scheme to gedit-3.14.0

colorsfontsgeditthemes

I change the xml file in the /usr/share/gtksourceview-3.0/styles/ but it didn't work, and when I want to add my own scheme through the Preference –> Font&Color and it replied that

"The selected color scheme cannot be installed".

what's wrong with it?

And I noticed that I have already change the gedit color scheme to "oblivion" and font site to 14, but when I start gedit from terminal using sudo gedit, the open window falls back to the default setting.

How can I fix this?

Best Answer

On my machine it seems gedit keeps its newly added themes at:

 ~/.gnome2/gedit/styles/

though I believe on some installations it is at:

 $HOME/.local/share/gedit/styles/

The original themes are (on my machine) at:

 /usr/share/gtksourceview-2.0/styles/


So the information below isn't particularly relevant, though I'll let it stay because it might help in some way.

From the documentation at: https://wiki.gnome.org/Projects/GtkSourceView/StyleSchemes

To install a style just place its XML file into a folder of the style search path.

GtkSourceView 2

A typical search path for GtkSourceView version 2 looks like:
        ~/.local/share/gtksourceview-2.0/styles/
        /usr/share/gnome/gtksourceview-2.0/styles/
        /usr/local/share/gtksourceview-2.0/styles/
        /usr/share/gtksourceview-2.0/styles/

If this does not work in your distribution you can find out your style search path with this python script. To run it you need the python bindings for GtkSourceView 2. In Debian-based distributions this is package python-gtksourceview2.

GtkSourceView 3

A typical search path for GtkSourceView version 3 looks like
        ~/.local/share/gtksourceview-3.0/styles/
        /usr/share/gnome/gtksourceview-3.0/styles/
        /usr/local/share/gtksourceview-3.0/styles/
        /usr/share/gtksourceview-3.0/styles/

Related Question