12

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?

5 Answers 5

15

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/

2
  • I downloaded Dracula, added it to gedit through Edit -> Preferences -> Fonts & Colors -> + , and the dracula.xml file ended up in ~/.local/share/gedit/styles/
    – WillC
    Jun 22, 2017 at 6:22
  • I had to use "install new style" button at the bottom even after adding file to ~/.local/share/gtksourceview-3.0/styles/ to make it appear in the list without restarting gedit. The UI displayed me an error message about not being able to install the style but it still appeared in the list and seems to work just fine. Feb 2, 2022 at 8:46
3

You can find free themes here: https://wiki.gnome.org/Projects/GtkSourceView/StyleSchemes

  1. Find your theme and click download.

  2. An xml code will appear. Copy and it and open your text editor.

  3. Paste your xml code and save under xml format (name_of_your_theme.xml).

  4. In gedit select Edit->Preferences->Font & Colors then click on the "+" to add new themes.

  5. Choose your theme.

1

I've found a way to solve this problem:

  1. Open Ubuntu Software Center, search for gedit
  2. Add optional add-ons "A Set of gedit plugins for developers" & "Set of plugins for gedit"
  3. Enable the addons from gedit preferences, especially "Color Scheme Editor"
  4. Edit your own color scheme for gedit and save.

But I still got a question: I search the /usr/share/gtksourceview-3.0/styles/ folder, but can not find my own color scheme file that I just created. Where did the system store the color scheme file?

1
  • FYI I'm using gedit v3.18.3 on Linux Mint 18 and the 2 developers plugins installed properly via Synaptic Package Manager, but the editor does not save
    – kurdtpage
    Jul 12, 2017 at 11:46
0
  1. visit https://wiki.gnome.org/Projects/GtkSourceView/StyleSchemes
  2. Find your desired theme, click download
  3. Open your gedit text editor
  4. Go to Edit ---> Preference ---> Font & Colors
  5. Click the + Arrow to install scheme, find scheme download location, add scheme and there you go.
0

When you load the xml file from directory to change the theme, thoroughly check the syntax and whether the code is error free. If everything is fine, the theme should load without any problem. As for the crashing of the window, I suggest you purge and reinstall gedit, or just reinstall ubuntu altogether. It's quite inefficient, but it ensures that there isn't any inherent bug which might have been caused due to user interference.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .