Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have been looking, but cannot find out how ReplaceColor works in the css and with the Site Settings Themes area that some users can see?

/* [ReplaceColor(themeColor:"Dark2")] */ color:#666666;

Is it a CSS hook of somesort for DARK2 in the themes area?

share|improve this question
add comment

2 Answers 2

up vote 2 down vote accepted

SharePoint 2010 (not certain if 2007 has) has new feature named theamable css. This are normal css files, that usually should be placed under 14\TEMPLATE\LAYOUTS\1033\STYLES\Themable\. The only difference is magic /* [ReplaceColor(themeColor:"Dark2")] */ lines. If you go to site theme settings, you can see this settings: enter image description here
So, what does actually this line mean: /* [ReplaceColor(themeColor:"Dark2")] */ color:#666666;?

It means, that if you apply theme to your site, your color (#666666) will be dynamically replaced with color, which is currently selected under Dark 2 in particular theme(see screenshot above).

How does it internally work? Every time when you select a theme for site (theme is a .thmx file actually), sharepoint dynamically open .thmx, extracts color and fonts, and then replaces all ReplaceColor-like placeholders with particular color from .thmx. All this parsed css later holds in your site under /_catalogs/theme/Themed/<theme unique id>/<css file>.css (you can verify it using sharepoint manager). When theme is applied, all css files (and even some images) references from this site folder. This is how all this magic works :).
You can also use RecolorImage feature for images, but I don't know exact understand how it works.

Additional info about themeable css: Leveraging Themable CSS

share|improve this answer
add comment

When a theme is chosen, SharePoint looks for specific CSS markup comments and the referred CSS and replaces the colors and fonts as it appears right below the comments line. ReplaceColor is one of the token Sharepoint would look for so in your case #666666 will be replaced by whatever Dark2 color you choose from in the site settings.

See if this article helps you: http://blog.sharepointbits.com/2010/01/how-themes-work-in-sharepoint-2010_04.html

share|improve this answer
    
Yes! Thanks @ashish that confirms my thought. Great article btw. –  user6876 Feb 11 '12 at 20:34
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.