I’m not sure I’ll use themes again over the AlternateCssUrl again in a hurry, but I did decide to take a look at the 10 example themes Microsoft Released in March. I’ll blog about how they look – sometime! (The short answer – some good, some bad, some awful!)
Anyway, I was interested that the themes could all be activated as features. This rather kept with my feeling on how branding should be deployed.
However, some of the themes (though not all) were suddenly available in the ‘Site Themes’ page of my SharePoint system. I knew from experience that this isn’t something that ‘just happens’ – previously, I’ve done it by hand.
EDIT: See the comments – they describe an possible pit fall, but both have articles about how to do the same thing…
I became curious, so I opened up Reflector. I found that there is a method called when the feature is installed to update the SPThemes.xml file:
ModificationType is just a private enumeration to tell you whether you are adding or removing an entry from the SPThemes file. This code is called from within a Feature Receiver during FeatureActivated FeatureInstalling (need to check, see comments below)
Anyway, I’ll remember this in case I should need to do similar. Obviously, the original code is probably simpler than the decompiled stuff.