|
Article relates to
|
RadControls for WinForms 2008 Q3
|
|
Created by
|
Nikolay Ganchev
|
|
Last modified
|
Nov 21 2008
|
|
Last modified by
|
Nikolay Ganchev
|
INTRODUCTION
The following KB article will introduce you to Color Blending.
Since Q3 2008 release we have implemented a color blending feature within our products that works similar to the way the professional graphics design tools do.
The result is an new elegant approach to customizing the appearance of your applications. For instance, take a look at the Desert theme. There is a smooth orange color all over. But if we take away all the orange and replace it with other color(s) we can get new themes.
SOLUTION
To apply the color blend, TPF will search through the theme's color RGB settings, convert them to HSL color space and calculate the new RGB color values, based on the newly selected color Hue. The code used to achieve all this looks similar to the following:
| Theme currentTheme = Telerik.WinControls.ThemeResolutionService.GetTheme("Desert"); |
| currentTheme.AddColorBlend("BaseColor", HslColor.FromColor(Color.Orange)); |
| currentTheme.ThemeProperties["BaseColor"] = HslColor.FromColor(Color.PaleGreen); |
| Dim currentTheme As Theme = Telerik.WinControls.ThemeResolutionService.GetTheme("Desert") |
| currentTheme.AddColorBlend("BaseColor", HslColor.FromColor(Color.Orange)) |
| currentTheme.ThemeProperties("BaseColor") = HslColor.FromColor(Color.PaleGreen) |
And since the theme modification is taking place at runtime you will be able to see all controls on the form changing their appearance corresponding to the new color blend base-color selection.
Themes like the MS Office-resembling Blue that has different set of colors based on the visual state of each piece of UI can be modified by adding several color blends at once.
If the resulting skin still needs some touches, you can export the modified theme data to xml files, and tweak them using the Visual Style Builder.
Please
Sign In
to rate this article.