cancel
Showing results for
Did you mean:
cancel
Showing results for
Did you mean:

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

1-Newbie

## convert Color (RGB) to Colornumber

Hello,

how do i convert a color from RGB Numbers to Colornumber for insert in the sd_sutomize file?

2 REPLIES 2
3-Visitor
(To:hkleinschmidt)

Hi Hubert -

I ran into some strange integers for color values in a Creo Parametric Toolkit application.
They might be the same format as yours. I saw the value 25685245 for a pale yellow

color. I did eventually find an algorithm to translate it.

Could you post a reply with a sample Colornumber value?

I'll see if it's the same format.

|+| M a r k |+|

Hello Hubert,

Custom colors can be read in either two formats RGB (Decimal) or in Hex numbers. If you are looking to create custom colors to use within Creo Elements Direct Modeling then it is best to create a custom palette file *.pal and place that in your customization folder under a folder labeled palettes. This way Modeling will read it on startup and those colors will become available to you during your working session.

Normal RGB to modeling RGB color number conversion is done by taking the RGB value and divide it by 255. Example 127/255=0.498. RGB (125,180,142) = RGB(.490,.706,.557).

As for Hex numbers take each value of the RGB color and convert it into a Hex number in a calculator and then put all three number pairs together to form the single Hex number string. Remember if you get a single value returned when converting the number to Hex then always add a 0 in front of that number in the final string. Example 11 = B when converted to Hex so added the 0 in front of the B to equal 0B.

Example RGB (125,180,142) = 7DB48E.

Example of a palette file MyColors.pal

(

:PALETTE-NAME "MyColors"

:FORMAT :RGB

:COLORS

(

(0.490,0.706,0.557 "Medium Green")

("#7d85b4" "Purple Gray")

)

)

HTH.

Regards,

Thom

Announcements