Legible svn diffs in Gmail

For my day job, I now have to read many svn commit messages per day, typically via email (though a view via trac is just a click away). Gmail tries to be helpful by adding underline formatting to line additions and strikethrough formatting to removals, but the result is a nasty ball of unreadable spaghetti. I went in search of an extension that would fix this for me and found the Beanstalk SVN Diff Colorizer for Gmail, which is very nearly what I was after. I made one tiny addition of removing the text-decoration properties, and now I have beautifully legible commit emails in my gmail. I went from this:

The old, busted way to read svn diffs in Gmail.

to this:

The new, awesome way to view svn diffs in Gmail.


And here’s the script:

// ==UserScript==
// @name          SVN Diff Colorizer for GMail (based almost wholly on Beanstalk Diff Colorizer for Gmail - http://userstyles.org/styles/14853)
// @namespace     http://userstyles.org
// @description   Adds colorization to SVN diffs received via  Could be made to work with your webmail of choice, and probably some other SVN hosts, with minimal fuss.
// @author        Matt Gillooly
// @include       http://mail.google.com/*
// @include       https://mail.google.com/*
// @include       http://*.mail.google.com/*
// @include       https://*.mail.google.com/*
// ==/UserScript==
(function() {
var css = "ins { background-color: #cfc; text-decoration: none; }\n\n  del { background-color: #fcc; text-decoration: none; }";
if (typeof GM_addStyle != "undefined") {
} else if (typeof PRO_addStyle != "undefined") {
} else if (typeof addStyle != "undefined") {
} else {
        var heads = document.getElementsByTagName("head");
        if (heads.length > 0) {
                var node = document.createElement("style");
                node.type = "text/css";

The only change I made was to tweak the styles so that only the coloration (and not the line-through or underline text formatting) is displayed.

2 thoughts on “Legible svn diffs in Gmail

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s