Custom Colours in .ini file are reading backwards

Custom Colours in .ini file are reading backwards

aksel_alvarez
Contributor Contributor
742 Views
2 Replies
Message 1 of 3

Custom Colours in .ini file are reading backwards

aksel_alvarez
Contributor
Contributor

Today I was setting up my custom Colours in the .ini file and noted something weird, the colours were loaded "inverted" so I had to fix the HEX.

I'm posting this here, since I'm wondering if there is a reason to this or it is just some kind of bug that is out there in Revit and nobody has cared about fixing it.

It is relevant for me since I'm planning to batch create hundreds of materials via script and plan to define their properties, including colour, out of a spreadsheet and would be good if I can avoid reconverting HEX codes.

akselalvarez_0-1666004891961.png

 

743 Views
2 Replies
Replies (2)
Message 2 of 3

jeremy_tammik
Alumni
Alumni

When you say "inverted", do you mean that something changed in your ini file? Or is it consistently different from what you expect? Do you expect the standard RGB sort order, with red, green and blue, in that order? Maybe Revit uses a different convention? I really don't know.

  

I would suggest looking at the Color class in the Revit API documentation and its real-life incarnation in the RVT database via RevitLookup and other db exploration tools:

  

  

That might give a hint of what to expect in the ini file as well. Or, if your ini file RGB sort order is consistently different, e.g., BGR, then maybe that is just the way Revit prefers it.

  

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

aksel_alvarez
Contributor
Contributor

Hi Jeremy! Thanks for answering. This is weird, but yes, the thing is that Revit seems to be reading these colours as BGR instead of RGB, so I have to "flip" the hex to get it right. I haven't had this issue in other places, but I want to ask in case I'm missing something here.