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

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

convert Color (RGB) to Colornumber

hkleinschmidt
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

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
Business Continuity with Creo: Learn more about it here.

Top Tags