17

Meld 1.5.1 uses gtksourceview (via pygtksourceview) for its syntax-highlighting, however I'm unable to figure out how to configure it to use a specific style (color scheme/theme) from the ones available to gtksourceview.

Maybe the solution is outside of meld - eg, settings the default style used for gtksourceview in general, or something similar.

chris
  • 321
  • 1
  • 2
  • 7

5 Answers5

7

According to the now relevant page :

Update example for GTK+ 3. In December 2013, Meld was updated to use GtkCssProvider instead of gtkrc (commit log). The new location of its default colour profile is /usr/share/meld/meld.css

There is also an example of the new way to configure meld.

Clément
  • 73
  • 1
  • 4
  • 2
    Not working on Meld 3.14.2 under Ubuntu-Mate 16.04.3 LTS. (trying to get dark colors for a general dark theme...) – Frank N Sep 04 '17 at 12:45
  • 2
    OSX instructions: the style files are located in `Applications > Meld.app > Contents > Resources > share > gtksourceview-3.0 > styles`. (If not, right-click on `Meld.app`, choose "Show Package Contents", and then search for a file named `meld-base.xml` within `Meld.app`.) Duplicate your favorite style file, such as `meld-base.xml`, and edit it. In addition to modifying the hex color codes, make sure to change `id` and `_name` in `` to avoid conflict. Restart Meld, then choose your new scheme from the drop-down menu at `Meld>Preference>Editor>Syntax Highlighting Color Scheme`. – Jess Riedel Sep 18 '17 at 14:49
  • Confirmed the OSX instructions above work; it's now 2023, and the Meld path is `/Applications/Meld.app/Contents/Resources/share/gtksourceview-4/styles`. If you search for "gtksourceview color schemes" you'll get lots of hits -- e.g., I copied the Monokai one from https://github.com/trusktr/gedit-color-schemes/blob/master/gtksourceview-3.0/styles/Monokai.xml and dropped it in (renaming it to lowercase `monokai.xml` for consistency) and it worked. – Tom Hundt Mar 18 '23 at 21:55
  • (cont.) I also tried the Monokai Extended from https://wiki.gnome.org/Projects/GtkSourceView/StyleSchemes and that worked, too. The readme at https://github.com/kberns/gtksourceview-styles lists a bunch of apps that use gtksourceview, so you can probably search for color schemes for them by name, too. Let the colorizing begin! – Tom Hundt Mar 18 '23 at 21:59
6

In Meld 3.16.4 you can simply choose color scheme in Meld > Preferences:

meld prefernces

(possibly this change was introduced in earlier versions)

Tombart
  • 1,505
  • 1
  • 14
  • 14
1

The process seems to involve creating a file ~/.gtkrc-2.0 to overwrite the meld defaults.

You can find some examples for Dark Themes in the wiki

Also, do not forget to change the theme name from the predefined one, or it will use that.

scytale
  • 142
  • 7
jrierab
  • 156
  • 4
1

I had trouble doing this in .gtkrc-2.0 for meld-1.3.0 under Solaris

Instead I found I could affect them in ~/.meld/meldrc.ini

Example, under the [DEFAULT] section

color_delete_bg = #003300
color_delete_fg = red
color_replace_bg = #112233
color_replace_fg = gray80
color_conflict_bg = pink
color_conflict_fg = white
color_inline_bg = #223344
color_inline_fg = white
color_edited_bg = gray20
color_edited_fg = white
Captain Lepton
  • 1,900
  • 3
  • 15
  • 11
0

Not sure, if it is possible to make meld to use another theme, but you always can edit default theme, which is classic.xml.

For Ubuntu 14.04 it is located in:

/usr/share/gtksourceview-2.0/styles/classic.xml

If you are using another os, location could differ.

See https://wiki.gnome.org/Projects/GtkSourceView/StyleSchemes.

Astronavigator
  • 191
  • 1
  • 1
  • 2