8

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?

8

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/

| improve this answer | |
  • 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 '17 at 6:22
1

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.

| improve this answer | |
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?

| improve this answer | |
  • 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 '17 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.
| improve this answer | |
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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.