This site has been retired. For up to date information, see handbook.gnome.org or gitlab.gnome.org.


[Home] [TitleIndex] [WordIndex

To use dark GTK themes with meld you will need to override it's default colours.

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

This example uses the same values as the now outdated example from the next section, except with the format changed to work with the latest version of Meld

@define-color insert-bg #002200;
@define-color insert-outline shade(@insert-bg, 1.8);
@define-color insert-text #008800;
@define-color delete-bg #111111;
@define-color delete-outline shade(@delete-bg, 1.8);
@define-color delete-text #880000;
@define-color replace-bg #000033;
@define-color replace-outline shade(@replace-bg, 1.8);
@define-color replace-text #0044dd;
@define-color conflict-bg Pink;
@define-color conflict-outline shade(@conflict-bg, 1.8);
@define-color conflict-text #ff0000;
@define-color error-bg #fce94f;
@define-color error-outline shade(@error-bg, 1.8);
@define-color error-text #faad3d;
@define-color inline-bg #333366;
@define-color inline-fg Red;
@define-color unknown-text #888888;
@define-color current-line-highlight #111100;
@define-color syncpoint-outline #555555;
@define-color current-chunk-highlight #800080;

.meld-notebook-toolbar.toolbar {
    background-image: none;
    background-color: @theme_base_color;
    border-width: 0 0 1px 0;
    border-style: solid;
    border-color: @borders;

    -GtkToolbar-button-relief: none;
    padding: 3px 2px 2px 2px;
}

LinkMap {
    border-width: 0 0 1px 0;
    border-style: solid;
    border-color: @borders;
}

.meld-vc-console-pane {
    border-width: 1px 0 0px 0;
    border-style: solid;
    border-color: @borders;
}

To see the defaults, refer here: https://git.gnome.org/browse/meld/tree/data/meld.css

This technique is now outdated

Create a file ~/.gtkrc-2.0

and fill in the colours you with to override. An example is below that works well with a dark theme.

style "meld-color-scheme-user"
{
    color["insert-bg"] = "#002200"
    color["insert-outline"] = shade(1.8, @insert-bg)
    color["insert-text"] = "#008800"


    color["delete-bg"] = "#111111"
    color["delete-outline"] = shade(1.8, @delete-bg)
    color["delete-text"] = "#880000"

    color["replace-bg"] = "#000033"
    color["replace-outline"] = shade(1.8, @replace-bg)
    color["replace-text"] = "#0044dd"

    color["conflict-bg"] = "Pink"
    color["conflict-outline"] = shade(1.8, @conflict-bg)
    color["conflict-text"] = "#ff0000"

    color["error-bg"] = "#fce94f"
    color["error-outline"] = shade(1.8, @error-bg)
    color["error-text"] = "#faad3d"

    color["inline-bg"] = "#333366"
    color["inline-fg"] = "Red"

    color["unknown-text"] = "#888888"

    color["current-line-highlight"] = "#111100"

    color["syncpoint-outline"] = "#555555"
}
widget "meldapp.*" style : highest "meld-color-scheme-user"

Here is a second example of a dark theme:

style "meld-color-scheme-user"
{
    # inserted line(s), also edge color block for added file in dir diff
    color["insert-bg"] = "#006000"
    color["insert-outline"] = shade(1.5, @insert-bg)
    # In dir diff, an added file's name
    color["insert-text"] = "#00CC00"

    # Color block on edge for missing file in dir diff
    color["delete-bg"] = "#800000"
    color["delete-outline"] = shade(1.8, @delete-bg)
    # Not sure what this is for
    color["delete-text"] = "Cyan"

    # Changed line(s), and edge color block for changed file in dir diff
    color["replace-bg"] = "#685020"
    color["replace-outline"] = "#604820"
    # Changed file in dir diff
    color["replace-text"] = "#e07000"

    # Not sure what these are for
    color["conflict-bg"] = "Cyan"
    color["conflict-outline"] = shade(1.8, @conflict-bg)
    color["conflict-text"] = "Cyan"

    # Not sure what these are for
    color["error-bg"] = "Cyan"
    color["error-outline"] = shade(1.8, @error-bg)
    color["error-text"] = "Cyan"

    # Added text on an existing changed line (per-word diffing)
    color["inline-bg"] = "#305030" # shade(1.3, @replace-bg)
    color["inline-fg"] = "#e0e080"

    # Crossed-out (not present) file in dir diff view
    color["unknown-text"] = "#e0e0e0"

    color["syncpoint-outline"] = "Yellow"
    # Currently selected chunk. Note: seems to automatically be blended with underlying color.
    color["current-chunk-highlight"] = "#800080"
}
widget "meldapp.*" style : highest "meld-color-scheme-user"

To see the defaults, refer here: https://git.gnome.org/browse/meld/tree/data/gtkrc


2024-10-23 10:58