How to change Revit ribbon tab color?

How to change Revit ribbon tab color?

jmmiller.southlandind
Enthusiast Enthusiast
10,364 Views
26 Replies
Message 1 of 27

How to change Revit ribbon tab color?

jmmiller.southlandind
Enthusiast
Enthusiast

I am currently struggling with changing the color of  tab header on the Revit ribbon. I have attempted to source answers from The Building Coder's Pimp my AutoCAD or Revit Ribbon blog among others, but have been unable to get the results I am seeking. As you can see from the image below I can get the panel background to color using a TabThem. The TabTheme has allows me to set TabHeaderBackground and TabHeaderForeground, which I would have thought would be what I was looking for. I would have expected my below code to color the panel background and the tab header orange. 

 

I would be grateful for any advice anyone could offer to point me in the right direction to getting the tab header to change color. 

 

 

            adWin.RibbonControl ribbon = adWin.ComponentManager.Ribbon;

            LinearGradientBrush gB = new LinearGradientBrush();
            gB.StartPoint = new System.Windows.Point(0, 0);
            gB.EndPoint = new System.Windows.Point(0, 1);
            gB.GradientStops.Add(new GradientStop(Colors.Orange, 0.0));
            gB.GradientStops.Add(new GradientStop(Colors.Orange, 1));

            Autodesk.Internal.Windows.TabTheme myTheme = new 
            Autodesk.Internal.Windows.TabTheme();
            myTheme.PanelBackground = gB;
            myTheme.TabHeaderBackground = gB;
            myTheme.TabHeaderForeground = gB;       


            ribbon.FindTab("BIM TOOLS").Theme =  myTheme;

 

 

TabColor.PNG

10,365 Views
26 Replies
Replies (26)
Message 2 of 27

jeremytammik
Autodesk
Autodesk

The Revit API and the Revit user interface do not support this.

  

All I know is in the article you pointed out.

  



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 3 of 27

jmmiller.southlandind
Enthusiast
Enthusiast

@jeremytammik  thank you for the quick reply. You indicated that Revit user interface does not support this feature. Is there any other method you are aware of to change the tab header color? I ask because my inspiration to try to figure out how it is done was derived from an add-in that has the tabs colored. Please see image. 

 

Also, for my own education. If the TabHeaderBackground and TabHeaderForground are not controlling the Tab, do you have any idea what they do control? 

 

 

 

 
 

TabColor.PNG

 

0 Likes
Message 4 of 27

RevitBuilder43
Contributor
Contributor
0 Likes
Message 5 of 27

RevitBuilder43
Contributor
Contributor
0 Likes
Message 6 of 27

Omar_Amen
Advocate
Advocate

Interesting question, any updates or work-around way ??

0 Likes
Message 7 of 27

jeremy_tammik
Alumni
Alumni

I repeat the answer I gave above:

 

The Revit API does not support this, and the development team have good reasons for this decision.

 

I you wish to violate the standard Revit UI standards, you can refer to the article discussed above.

 

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 8 of 27

RevitBuilder43
Contributor
Contributor
Message 9 of 27

JamesPark_Acad10
Community Visitor
Community Visitor

Unfortunately, Autodesk has removed that app.

Autodesk:  we need to have the ability to change tab colors !!!

0 Likes
Message 10 of 27

jeremy_tammik
Alumni
Alumni

You could submit a wish for this functionality to the Revit Idea Station. Whenever you require a new or enhanced Revit product or Revit API functionality, the Revit Idea Station is the place to go. Please search there for a corresponding wish list entry for the suggested functionality and add your comments to it, or create a new one, if none already exists:

  

  

If it is a pure API related wish, tag it as such:

  

  

Ensuring that a wish gets as many votes as possible helps underline its importance to you and the rest of the developer community. The Revit Idea Station is currently one of the main driving input forces for Revit API enhancements. The Revit development team looks there. Your comment here in the discussion forum might be overlooked. Thank you!

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 11 of 27

Speed_CAD
Collaborator
Collaborator

Hi,

 

Yes, that's possible!

 

tab inactive.pngtab mousemove.pngtab active.png

Mauricio Jorquera
0 Likes
Message 12 of 27

rmaxiluna
Explorer
Explorer

PyRevit has a tool for colorize tabs, 

Message 13 of 27

tuah_edu
Explorer
Explorer
I believe the original question is to colorized the add-on tab itself, not opened Revit tabs. But this pyRevit feature is indeed a nice to have when you constantly have multiple .rvt .rfa files opened in a Revit session.
0 Likes
Message 14 of 27

maisoui
Advocate
Advocate

@Speed_CAD Ok, nice, but how? Can you share your code snippet please?

 

 

--
Jonathan
0 Likes
Message 15 of 27

Speed_CAD
Collaborator
Collaborator

Hi maisoui,

 

Sorry, I hadn't seen your message. I had left aside the code to change the color of the Ribbon tabs, a week ago I resumed this development to customize the Ribbon tabs and added a command search engine, all of this to test and it is taking good shape. I am also customizing the document tabs.

 

Mauricio Jorquera
Message 16 of 27

Moustafa_K
Collaborator
Collaborator

Well the answer to this a bit long, are your ready!

 

Short version

All in all, it is doable, but i wouldn't recommend much playing with UI styles.

 

Based on my personal experiments, I found that customizing view tabs in Autodesk Revit can enhance the design flow and make the UI more intuitive. I personally do it for myself satisfactory. Although there is no official documentation, these techniques can help users manage Styling the UI.

 

Revit's UI is built with Windows Presentation Foundation (WPF), allowing for property changes such as background colors. The key to UI customization is the ApplicationTheme class in the UIFramework assembly, which controls most Revit themes.

StylingDifferences.gif

I have documented what I was able to figure out, it was good experience to see all these UI controls how they behave and connected together.

Break Down Part A.png

 

To change the color of View tabs, modify properties like CanvasActiveTabNormalBackgroundColor and CanvasActiveTabHoverBackgroundColor:

 

 

var appTheme = UIFramework.ApplicationTheme.CurrentTheme;
appTheme.CanvasActiveTabNormalBackgroundColor = Colors.DarkRed;
appTheme.CanvasActiveTabHoverBackgroundColor = Colors.DeepPink;

 

 

For more details "Long version Answer", refer to my full article on this topic.

Moustafa Khalil
Cropped-Sharp-Bim-500x125-Autodesk-1
Message 17 of 27

ankofl
Advocate
Advocate

Can we find out at least one of these "big reasons"? Reasons that run counter to the interests of a large number of users?

Message 18 of 27

jeremy_tammik
Alumni
Alumni

That is something you would have to discuss with the product managers and UI designers, not with the programmers, and this is not an appropriate place to do so. Please discuss all UI related questions in one of the non-API-related forums:

  

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 19 of 27

ankofl
Advocate
Advocate

Hi @Moustafa_K !

It worth noting, Tab View has a trigger that resets the style to its default color. This means upon ... 

May I ask you to explain how you can specify the color of a tab depending on the project associated with it? I know that this is possible, because I have seen similar functionality in other programs, but perhaps you have thoughts on this?

ankofl_1-1719238478460.png


I would like to set the color of these panels not to be common to all open projects (i.e. not depending on whether the panel is active or selected, but on which project it is)

Thanks!

0 Likes
Message 20 of 27

Speed_CAD
Collaborator
Collaborator

Hi ankofl

 

To do that requires more depth, because it is not possible to do it through the native properties exposed by the Revit API. Here I have placed two videos where you can see what is possible to do, but I am still testing, that is why I have not uploaded code.

 

https://forums.autodesk.com/t5/forums/forumtopicprintpage/board-id/160/message-id/79613 

Mauricio Jorquera
0 Likes