# Change Autodesk.Revit.DB.Color to DSCore.Color

**URL:** <https://forum.dynamobim.com/t/change-autodesk-revit-db-color-to-dscore-color/80989>\
**Category:** Revit\
**Created:** [September 13, 2022, 6:14pm UTC](https://forum.dynamobim.com/t/change-autodesk-revit-db-color-to-dscore-color/80989 "2022-09-13T18:14:20Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![christian.stan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/christian.stan/32/166296_2.png) [@christian.stan](https://forum.dynamobim.com/u/christian.stan)\
**Post date:** [September 13, 2022, 6:14pm UTC](https://forum.dynamobim.com/t/change-autodesk-revit-db-color-to-dscore-color/80989/1 "2022-09-13T18:14:21Z")

</div>

Hello,  
I tried to place color palette nodes in a user interface (I couldn’t)  
Therefore I went through a color pickup, is it possible to recover (the a,r,g,b of Autodesk.Revit.Db.Color)  
Thanks in advance for the help provided.

 ![13 septembre Mode constructifs essais_2022-09-13_08-04-30](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/1/b/1bd590068edcc1279f05c17f606afee51f8131bc.png)

Cordially  
christian.stan

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [September 13, 2022, 6:20pm UTC](https://forum.dynamobim.com/t/change-autodesk-revit-db-color-to-dscore-color/80989/2 "2022-09-13T18:20:40Z")

</div>

There is no alpha, it’s always 255.

The Red, Green and Blue values are properties of a color in the Revit API. So assuming you have the proper imports, you can try this:

```auto
colors = IN[0]
rgbValues = [c.Red, c.Green, c.Blue for c in colors]
OUT = rgbValues

```

If you import the DSCore module as well, you can then directly generate the Dynamo color values. SOmething like this:

```auto
#Standard imports here
clr.AddReference('DSCoreNodes')
import DSCore
revitColors = IN[0]
dynamoColors = [DSCore.Color.ByARGB(255, c.Red, c.Green, c.Blue) for c in revitColors]
OUT = dynamoColors

```

---

<div class="post-metadata">

**Author:** ![sovitek](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/sovitek/32/116237_2.png) [@sovitek](https://forum.dynamobim.com/u/sovitek)\
**Post date:** [September 13, 2022, 6:23pm UTC](https://forum.dynamobim.com/t/change-autodesk-revit-db-color-to-dscore-color/80989/3 "2022-09-13T18:23:08Z")

</div>

Hi Christan it normally work for me i jthink you just need a pattern as well…edit saw you already has a pattern 🙂 hmmmm strange then

---

<div class="post-metadata">

**Author:** ![christian.stan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/christian.stan/32/166296_2.png) [@christian.stan](https://forum.dynamobim.com/u/christian.stan)\
**Post date:** [September 13, 2022, 6:38pm UTC](https://forum.dynamobim.com/t/change-autodesk-revit-db-color-to-dscore-color/80989/4 "2022-09-13T18:38:23Z")

</div>

Hello,  
Thank you very much it works wonderfully 👌 (can only be done in python?)

 ![Capture d’écran 2022-09-13 203945](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/c/b/cb846cb82861c6ea0da77bee5ec2edd65ff0809c.jpeg)

Cordially  
christian.stan

---

<div class="post-metadata">

**Author:** ![christian.stan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/christian.stan/32/166296_2.png) [@christian.stan](https://forum.dynamobim.com/u/christian.stan)\
**Post date:** [September 13, 2022, 6:52pm UTC](https://forum.dynamobim.com/t/change-autodesk-revit-db-color-to-dscore-color/80989/5 "2022-09-13T18:52:47Z")

</div>

Hello,  
I am under the Revit 2020 version, it may be from this state (Thank you @ you).

Cordially  
christian.stan

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [September 13, 2022, 11:04pm UTC](https://forum.dynamobim.com/t/change-autodesk-revit-db-color-to-dscore-color/80989/6 "2022-09-13T23:04:12Z")

</div>

There may be a Revit.Color class somewhere, but I haven’t come across it. Genius Loci package, or another package which deals with materials may have something. I am 90% certain it isn’t in the Revit section of the library, which means I am 90% certain that some type of custom code would be required, be it Python or a zero touch node.

Whenever I have needed to convert colors between applications I have just done the above in my code base, as it’s simple enough that it doesn’t necessarily slow down efforts, while moving along an extra node or two might…

---

<div class="post-metadata">

**Author:** ![jedbjorn](https://avatars.discourse-cdn.com/v4/letter/j/c57346/32.png) [@jedbjorn](https://forum.dynamobim.com/u/jedbjorn)\
**Post date:** [October 25, 2022, 11:37pm UTC](https://forum.dynamobim.com/t/change-autodesk-revit-db-color-to-dscore-color/80989/7 "2022-10-25T23:37:41Z")

</div>

dragging up an old thread so I dont have to make a new one- Im a python noob, when I run this I get an iteration over non sequence error. Im kinda stuck in a graph where i need to convert a revit color to a dscore color. help ^^ 🙂

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [October 25, 2022, 11:38pm UTC](https://forum.dynamobim.com/t/change-autodesk-revit-db-color-to-dscore-color/80989/8 "2022-10-25T23:38:41Z")

</div>

Please start a new thread and include a sample graph with the python so we can reproduce.

By the sound of it you’re passing a null object, so check inputs and data retrieved first.

---

<div class="post-metadata">

**Author:** ![jedbjorn](https://avatars.discourse-cdn.com/v4/letter/j/c57346/32.png) [@jedbjorn](https://forum.dynamobim.com/u/jedbjorn)\
**Post date:** [October 25, 2022, 11:55pm UTC](https://forum.dynamobim.com/t/change-autodesk-revit-db-color-to-dscore-color/80989/9 "2022-10-25T23:55:04Z")

</div>

> [@jacob.small](#):
>
> ```auto
> clr.AddReference('DSCoreNodes')
> import DSCore
> revitColors = IN[0]
> dynamoColors = [DSCore.Color.ByARGB(255, c.Red, c.Green, c.Blue) for c in revitColors]
> OUT = dynamoColors
> 
> ```

Wait, I have noticed my python scripts execute before my graph, this might be the issue, because I am passing it a revitDB color from a Datashapes UI. will post tho.

---

<div class="post-metadata">

**Author:** ![kslifter](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/kslifter/32/192657_2.png) [@kslifter](https://forum.dynamobim.com/u/kslifter)\
**Post date:** [June 6, 2024, 3:00pm UTC](https://forum.dynamobim.com/t/change-autodesk-revit-db-color-to-dscore-color/80989/10 "2024-06-06T15:00:35Z")

</div>

I tried finding a new thread but couldn’t, this issue, at least as I can tell, is that you need to import sys and import clr.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/7/1/71078a8d3218f9ef31c8064c47f0a7ee5e75ff40.png)

I also threw in a Python Script to give me the total number of dims that were overridden

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/0/c/0c4d8995ca363d513158dce7af43700415678ee6.png)
