Thursday, 5 September 2013

Monodevelop 4.0 and dark themes

Monodevelop 4.0 (or "Xamarin Studio" if you're one of the blessed Mac or Windows users) was released a fair while back with great fanfare as the new, awesome major re-designed version of Monodevelop. I think it's fair to say that I wasn't impressed.

Aside from the ever-present nightmare of building the damn thing (turns out you need to already have a version of monodevelop installed or the new version spews out a ton of errors when you build it), the folks behind Monodevelop managed to produce an IDE that was utterly unusable for me. Why? Because it only partially followed the system themes. Following themes is a really nice feature - it makes the application fit in with your working environment nicely and (if you're me) allows you to run it with a nice, dark look that doesn't give you a headache by lunchtime. I find the standard black text on glaring white background to be a great way to increase painkiller sales at my local shop.

Totally ignoring themes would be annoying, but hey, I can live with it. At least you can still get on and work, right?

Monodevelop 4 does neither.

Monodevelop 4 applies some of the colours to some of its interface. Which leads to the joy of trying to read light grey text (following my system theme) on a light grey background (ignoring my system theme). Some of the fancy new components that Xamarin have created to bling up the interface have partially hard-coded colour schemes. It's inexcusable, really; an inexplicable error to put in a supposedly polished, high(ish)-profile release. I can only assume that nobody ever thought to check what happened when you applied dark themes.

Maybe Xamarin have fixed it in later releases. Maybe not. I don't know, and I don't really care, because everything after 4.0 relies on having access to mono > 2.10.8.1 - and since Ubuntu (the platform I'm working on) hasn't had an update to mono in repos for the last three centuries or something I'd have to build mono to use it - but everything I work on needs to be capable of running on the version in repos. Yes, I could run parallel monos on my desktop, but just to fix a colour scheme? Really?

Personally I think it's totally understandable that those who use Mono/Monodevelop on Linux are beginning to feel like Xamarin has hung us out to dry. But that's an argument for another day. The point of this post is: You can hack the monodevelop sources to make your dark theme work enough to use 4.0. This isn't a fix as such; if you change the theme, you'll need to hack the sources again and recompile. I don't know my way around the monodevelop sources well enough to properly fix it (plus it's not my job to spend the time learning my way around and, fuck it, they don't see linux support as worthwhile, I don't see why I should spend my time fixing their shoddy engineering).

The Hack

To make Monodevelop usable with your dark theme (I use Nodoka-Midnight) you'll need to modify a few of the source files. The motherlode of hard-coded colours is in src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Styles.cs. I've used rather a blunderbuss approach, and some of the following changes may not strictly be necessary; feel free to apply them one by one and see which steps can be skipped:
  • Swap over the values of BaseForegroundColor and BaseBackgroundColor (lines 33 and 34)
  • Darken ThinSplitterColour (I set it to 31,31,31)
  • Darken the TabBarBackgroundColor (I used 2e2d2d)
  • Darken the BreadcrumbGradientStartColor (I used 484444)
  • Darken all the DockTabBar... colours (I used variants on 45d / 255d, 44d / 255d, 44d / 255d and halved the numerators for the ...Shadow... colours)
  • Similarly darken PadBackground, DockFrameBackground and BrowserPadBackground
That should get most of the interface at least usable. There's also a tab strip sitting under the main edit window in the default debugging layout which is almost impossible to read without changing its background colour, so in src/core/MonoDevelop.Ide/MonoDevelop.Components/Tabstrip.cs, line 40 darken BackgroundGradientStart to something like 45d / 255d, 44d / 255d, 44d / 255d

Now make & make install monodevelop and you should be able to use it with a dark system theme without half of the interface being illegible.

As I said, this is NOT a fix. It's a horrible hack. Monodevelop shouldn't be using hardwired colours at all - or it shouldn't be applying colours from the system theme at all. The way it's implemented is a textbook case of a half-baked feature being worse than none at all.

5 comments:

Uwe Keller said...

Thank you so much for this post! I had the same problem but was now able to fix it according your description. There are still some screws left (e.g. the code completion popup window), but i hope i will find them by myself. From my opinion it is a no-go to hardcode colors. The last time i used MonoDevelop is 2 years ago with version 2.x and the whole IDE fitted much better into the GTK environment. Now it is not that nice anymore. Thanks again!

Throctukes said...

Since this STILL isn't fixed, an alternative is to make MonoDevelop (special little flower that it is) run using a different theme to the rest of the system. Just edit the launch script at /usr/bin/monodevelop. Add something like

export GTK2_RC_FILES=/usr/share/themes/Aurora/gtk-2.0/gtkrc

before the closing if...else...fi that launches the application.

Some themes don't actually seem to do anything, so you may have to try a couple. Aurora and Clearlooks both definitely work. You can then set the editor inside the application to use a dark theme to reduce the blazing whiteness to some extent.

joshua graham said...

Hey thanks, this helped me. Just getting started with debian.

It's still relevant, and anyone looking to change the inactive tab color (i found it annoying) - this seems to be hardcoded in monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockNotebook/TabStrip.cs(lines 869 & 868)

fukin ridiculous.

Jason statham said...

I don"t cerebrate some of websites offer this typewrite of assemblage. premium wordpress themes

Jason statham said...

Your affect is totally appreciative and newsy. premium wordpress themes