How to change the syntax highlighting style in Meld

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.


Solution 1:

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.

Solution 2:

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

meld prefernces

(possibly this change was introduced in earlier versions)

Solution 3:

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

Solution 4:

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.