Themes Colour Blending

3 posts, 0 answers
  1. Kenneth Jackson
    Kenneth Jackson avatar
    60 posts
    Member since:
    Dec 2007

    Posted 18 Nov 2008 Link to this post

    I recently installed the Q3 components and really like the themes colour blending addition.
    I attempted to use this in a test app I created to test the new features.

    Now this is really simple code (love it) but for some reason I cannot get it to work.

    I have a form that inherits radform. I have a ribbonbar (pointless but just for testing) , a status
    bar and a button. The button , statusbar and form all use the desert theme and the ribbonbar
    the standard blue theme. I attempt to apply the colour blending after the button is clicked.
    The code for it is as follows.


    public partial class frmMain : RadForm
     private Theme currentTheme;
     private const string baseColorParamName = "BaseColor";

     public frmMain()



     private void radButton1_Click(object sender, EventArgs e)

      currentTheme = ThemeResolutionService.GetTheme("Desert");
      HslColor baseColor = HslColor.FromAhsl(0.118, 0.9, 0.9);
      currentTheme.ThemeProperties[baseColorParamName] = baseColor;


    The code generates no errors and the form borders sort of flicker as it happens,
    the colour blending however has no effect. I assume I am missing something
    simple but the code above barring the moving of some lines to a single proc,
    is identical to that in the examples.

    Could anyone shed some light on what I am doing incorrectly ?


  2. Mike
    Mike avatar
    640 posts

    Posted 19 Nov 2008 Link to this post

    Hello Kenneth Jackson,

    You can get this functionality working with just a few changes in the code you are using. Since this code was designed to work with the Desert theme you will not be able to use it with the RadRibbonBar control - the Desert theme does not apply for it. But you can modify this to work with the default themes for all controls - i.e. the ControlDefault theme.

    As you may have noticed the default theme of the RadRibobnBar control resembles the Office 2007-Blue theme. Thus we should change also the base-color which the blend will be calculated upon - in other words it should be blueish. For more info you may take a look at my blog post on theme color blends:

    Here is the modified code you may use:
    Theme currentTheme = ThemeResolutionService.GetTheme("ControlDefault"); 
    HslColor baseColor = HslColor.FromColor(Color.FromArgb(193, 216, 240)); 
    currentTheme.AddColorBlend(baseColorParamName, baseColor); 
    currentTheme.ThemeProperties[baseColorParamName] = HslColor.FromColor(Color.FromArgb(255, 216, 208)); 

    It styles the ribbon like this:
    Red Ribbon

    Let me know if you need assistance any further.

    Kind regards,
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Kenneth Jackson
    Kenneth Jackson avatar
    60 posts
    Member since:
    Dec 2007

    Posted 19 Nov 2008 Link to this post

    Hi Mike , thanks for the code as well as the explanation.

    Makes alot more sense now .


Back to Top