Ribbon with Themes: window title bar color

Posted by: wknauf on 24 September 2021, 3:16 pm EST

  • Posted 24 September 2021, 3:16 pm EST - Updated 3 October 2022, 10:37 pm EST

    Hi C1,

    this is an issue that we noticed while migrating to the new ribbon and themes:

    The old C1Ribbon with VisualStyle had a different title bar color for the currently active window:

    This feature has disappeared with themes. Here, only the font color is changed and a border is drawn (more ore less visible - for Office2010Silver, it is hardly visible):

    I assume that you did not add the “active form” title bar color by intent, as Windows 10 also removed this feature (which is a horrible decision in my opinion).

    At least, it is possible to reactive this feature: https://www.intowindows.com/how-to-change-window-border-color-in-windows-10/

    C1ThemeDesigner does not have a property for “Active form title background”, just a property “Title\Background”.

    We fear that our users might dislike the new visual appearance - my boss complained about it ;-), and I don’t like it too.

    So I want to bring up the suggestion to add this feature (maybe as optional feature)?

    Attached is a small sample for both ribbon versions, just to make it reproduceable.

    Best regards

    Wolfgang

    RibbonThemes.zip

  • Posted 27 September 2021, 12:52 am EST

    Hi Wolfgang,

    We have posted a feature request on your behalf to the development team and will let you know as soon as we get an update.

    [Internal Tracking ID: C1WIN-25715]

    Regards

    Avnish

  • Posted 4 March 2022, 5:46 am EST

    Change the color of my windows title bar by following this steps-

    Image result for Ribbon with Themes: window title bar color

    Change title bar color via Settings in Windows 10

    Step 1: Navigate to Settings > Personalization > Colors.

    Step 2: Select Title bars and window borders checkbox.

    Step 3: To change the color, on the same page, either click on of the color tiles or click the Custom option to create a color of your choice.

    Regards,

    Rachel Gomez

  • Posted 7 March 2022, 11:45 am EST

    Yes, that’s the same as the link my initial post said ;-).

    But I hope that C1 finds a better resolution… At least I preferred the old behavior.

    Best regards

    Wolfgang

  • Posted 18 October 2022, 8:32 am EST

    Hi C1,

    any updates on this request? Are there any plans to add this feature?

    Best regards

    Wolfgang

  • Posted 18 October 2022, 11:07 pm EST

    Hi Wolfgang,

    We have asked for an update from the development team regarding the feature request and will update you as soon as we hear from them.

    Regards.

    Avnish

  • Posted 20 October 2022, 1:23 am EST

    Hi Wolfgang,

    As per the development team, the ETA for this is the 23v1 release.

    We will let you know when we have further updates.

    Regards

    Avnish

  • Posted 12 April 2023, 7:25 am EST - Updated 12 April 2023, 7:40 am EST

    Found this in release notes:

    Added the FormInactiveBackground2, FormInactiveTitle and FormInactiveHotButton options to the StyleBrush enum. Added the FormInactiveHotGlyph option to the StyleColor enum. These options allow customize the C1RibbonForm header when other application is active. (Jira:C1WIN-25715)

    So the question is: how to use it? I found this line of code having an effect (also in attached sample):

    this.c1Ribbon1.RibbonStyle.BrushSet.SetColor(StyleBrush.FormInactiveBackground2, Color.Black);

    RibbonThemesTest_596.zip

    Is this the only way to use this feature? Or can this be done by themes?

    Is this change related?

    Added ‘C1Ribbon365/Form/Title/InactiveBackground’, ‘C1Ribbon365/Form/Buttons/HotInactive’ and ‘C1Ribbon365/Form/Qat/Inactive’ properties.

    If it can modified through themes: you didn’t add this feature to the default themes? Or would I have to define matching colors for each theme type?

    What is “FormInactiveTitle”? Is it relevant for ribbon forms?

    Update: “FormInactiveHotCloseButton” seems to be buggy: when setting it, the close button in the background form is a green box, the X symbol is not visible any more:

    this.c1Ribbon1.RibbonStyle.BrushSet.SetColor(StyleBrush.FormInactiveHotCloseButton, Color.Green);

    Best regards

    Wolfgang

  • Posted 13 April 2023, 6:55 am EST - Updated 13 April 2023, 7:21 am EST

    Hi Wolfgang,

    Yes, you can use this feature by using the C1Ribbon.RibbonStyle.BrushSet property.

    Currently, the distinction between the title bar of active and inactive forms is not added by default to the existing themes. We have shared your request with the development team to get their insights on it and will let you know the updates as soon as possible.


    In the meantime, you can use the ThemeDesigner application to create your custom themes and use the below change (which is related to this feature) to define a distinction between the title bar color of active/inactive forms in the existing themes.

    Added ‘C1Ribbon365/Form/Title/InactiveBackground’, ‘C1Ribbon365/Form/Buttons/HotInactive’ and ‘C1Ribbon365/Form/Qat/Inactive’ properties.


    Yes, the FormInactiveTitle is relevant for C1RibbonForms. It takes effect when you do not have a C1Ribbon control on your form and you are only using the C1RibbonForm.


    We could see the behavior you mentioned with the “FormInactiveHotCloseButton” property. We have reported this to the development team for further investigation and will update you as soon as possible.

    In the meantime, you can workaround this issue by setting the Color for the X symbol manually using the below code.

    this.c1Ribbon1.RibbonStyle.BrushSet.SetColor(StyleBrush.FormInactiveHotCloseButton, Color.Green);
    this.c1Ribbon1.RibbonStyle.ColorSet[StyleColor.FormInactiveHotCloseButton] = Color.Red;


    Attachment: RibbonThemesTest_596_updated.zip

    Thanks, and Best Regards,

    Kartik

  • Posted 13 April 2023, 9:40 am EST - Updated 13 April 2023, 9:46 am EST

    Hi Kartik,

    thanks for the reply.

    About your reply:

    In the meantime, you can use the ThemeDesigner application to create your custom themes and use the below change (which is related to this feature) to define a distinction between the title bar color of active/inactive forms in the existing themes.

    Added ‘C1Ribbon365/Form/Title/InactiveBackground’, ‘C1Ribbon365/Form/Buttons/HotInactive’ and ‘C1Ribbon365/Form/Qat/Inactive’ properties.

    I tried to modify the theme properties, but this does not have an effect, see attached sample:

    RibbonThemesTest_596_theme_modification.zip

    C1Theme theme = C1ThemeController.GetThemeByName("Material", true);
    
    BackgroundProp themeItem = (BackgroundProp)theme.Children.GetItemByPath("C1Ribbon365\\Form\\Title\\InactiveBackground");
    
    themeItem.Ref = null;
    themeItem.Value = new ThemeSolidBackground(Color.Black);
          
    C1ThemeController.ApplyThemeToControlTree(this, theme);

    Seems I have to do something different to make it work ;-). Or is this theme property meant for non-C1Ribbon forms?

    About the “FormInactiveHotCloseButton”: do you have a ticket number, or is it the same?

    Best regards

  • Posted 14 April 2023, 4:11 am EST

    Hi Wolfgang,

    Regarding:

    Currently, the distinction between the title bar of active and inactive forms is not added by default to the existing themes. We have shared your request with the development team to get their insights on it and will let you know the updates as soon as possible

    The development team has considered this as an enhancement request and will be working on it in future releases. We will let you know as soon as we have any updates on this. [Internal Tracking ID: C1WIN-29571]


    The property path you are using corresponds to the FormInactiveTitle property, which as we mentioned earlier, takes effect when you do not have a C1Ribbon control on your form and you are only using the C1RibbonForm.

    For your requirement, please use the path “C1Ribbon365\Form\Qat\Inactive\Background” which corresponds to the FormInactiveBackground2 property. Please see the updated sample project for reference.

    Attachment: RibbonThemesTest_596_PropPath.zip


    Regarding the bug report for “FormInactiveHotCloseButton”, the ticket number is [Internal Tracking ID: C1WIN-29573]

    Best Regards,

    Kartik

  • Posted 18 April 2023, 5:11 am EST

    Thanks, this works!

    Best regards

    Wolfgang

  • Posted 2 June 2023, 5:03 pm EST

    Well, I actually wanted to proudly present an updated sample that shows how the inactive form caption back color is modified automatically (based on the current theme settings, without having to do custom stuff on a per theme base).

    But my sample fails for all “Office365…” themes: I try to detect the current “C1Ribbon365\Form\Qat\Inactive\Background” setting, and if it has no value I also check parent themes until I find the one with defined value. For the “Office365…” themes, I end with a null value for “BackgroundProp.Ref”. See attached sample in “FormMain.comboBoxTheme_SelectedIndexChanged”, line 83.

    RibbonThemesTest_InactiveForm.zip

    So, the question is: how can I find the current color for the C1RibbonForm title area?

    The sample has two approaches to calculate the form caption color:

    -dark themes (I check “themeColor.GetBrightness”): switch the inactive form to a brighter value

    -light themes: switch the active form to a darker color, and keep the “inactive form” setting.

    In the current implementation (which uses “ControlPaint.Light/Dark”), the resulting “inactive” colors are not optimal - the sample contains commented code for calls to the native functions “ColorHLSToRGB” and “ColorRGBToHLS” which seem to return better results if modifying the “luminance” value.

    But first, I have to find a way to detect the current color for the “Office365…” themes (and maybe the old .NET 4.8 themes that we also bundle with out application).

    Best regards

    Wolfgang

  • Posted 5 June 2023, 10:16 am EST

    Hi Wolfgang,

    Apologies for the delay in response. We could see the behavior you mentioned on our end. As we observe, the colors for “Office2016…” themes are defined under “BaseThemeProperties\Office2016” but we did not find a reference to them through the theme. We are getting in touch with the development team to see if they can suggest a workaround and will let you know the updates as soon as possible.

    [Internal Tracking ID: C1WIN-29571]

    Best Regards,

    Kartik

  • Posted 13 June 2023, 11:38 am EST

    Attached is an updated sample that has better code to modify the color. Also, it includes the .NET 4.8 themes to show my algorithm on a larger variety of themes.

    RibbonThemesTest_InactiveForm_2023-06-13.zip

    The algorithm is:

    //Do something different for very bright themes ("MacSilver"). All others are handled by the first part:
    if (colorInactiveBackGround.GetBrightness() < 0.9)
    {
      //get luminance from color...
    
      //increment luminance by different values, depending on the original value: the darker the color, the bigger the increment.
      if (luminance  < 100)
      {
        luminance  += 80;
      }
      else if (luminance  < 150)
      {
        luminance  += 50;
      }
      else if (luminance  < 200)
      {
        luminance  += 30;
      }
      else
      {
        //rather bright, see "Office2007Blue" or "VS2013Red".
        luminance  += 20;
      }
    
      //get color with new luminance and set it to "InactiveBackground"
    }
    else
    {
      //If the theme is a bright theme, make  the active form darker and the inactive form brighter. See e.g. "MacSilver"
    
      //Switch "inactive" to the (bright) "default" color...
    
      //get luminance from color...
    
      //make it 20 brighter. Here, no thresholds are necessary, because we enter this piece of code only for very bright themes.
      luminance -= 20;
      //Don't go beyond 0  (max value) 
      light = Math.Max(light, 0);
    
      //build new color and set it to "ActiveBackground"
    }

    Maybe someone else finds this helpful, too.

    The only remaining question is: how can I get the colors from the .NET6 “Office2016” themes.

    Best regards

    Wolfgang

  • Posted 14 June 2023, 6:54 am EST

    Hi Wolfgang,

    Thanks a lot for your sharing your updated implementation.

    Regarding the colors of the .NET6 “Office2016” themes, as per the development team, if any theme property has no value, it means that the built-in default value will be used. This value depends on ThemeColor and ThemeLightness, but the theme itself does not know about these built-in values.

    The easiest way to get these built-in values is to create an empty Ribbon and set a combination of the desired ThemeColor and ThemeLightness to it. Then, you can use the RibbonStyle property of the empty Ribbon to get the color value. Please refer to the GetStateBackColors method in the updated sample project.

    Attachment: RibbonThemesTest_InactiveForm_Office2016Colors.zip

    Best Regards,

    Kartik

  • Posted 15 June 2023, 8:01 am EST

    Hi Kartik,

    thanks, this works like a charm. So, the Office365 colors are actually hardcoded in C1Ribbon and are not supplied by the theme.

    Best regards

    Wolfgang

  • Posted 16 June 2023, 1:41 am EST

    Hi Wolfgang,

    Yes, there are built-in default values for some theme properties which depend on ThemeColor and ThemeLightness. These values are fetched internally whenever the theme is applied and is directly set to the C1Ribbon.RibbonStyle without the theme actually knowing that value.

    Best Regards,

    Kartik

  • Posted 7 December 2023, 4:39 pm EST

    I can confirm that the issue “C1WIN-29573” (close button has wrong styling in inactive form is fixed in .631):

    'X' symbol in the close button was not shown for the inactive form. (Jira:C1WIN-29573)

    Best regards

    Wolfgang

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels