CityEngine Color Codes

4106
3
Jump to solution
05-13-2016 03:59 AM
MartaBescansa1
New Contributor II

Hi,

I would like to know how the colors work on CityEngine. What are these parameters that I see?

#448892

#ff0000

and many more....

I guess they correspond to a certain color. I would like to know where I can find the list of color codes, so I can choose and insert them.

Thank you,

Marta

0 Kudos
1 Solution

Accepted Solutions
BenjaminMittler
Occasional Contributor III

These look to be Hex color codes.

#448892 is a blueinsh tint

#ff0000 is red

Color Hex Color Codes 

View solution in original post

0 Kudos
3 Replies
BenjaminMittler
Occasional Contributor III

These look to be Hex color codes.

#448892 is a blueinsh tint

#ff0000 is red

Color Hex Color Codes 

0 Kudos
LR
by
Regular Contributor

They represent R/G/B values, from 00-FF (= 0-255) in hexadecimals. You could also use 0-1, e. g. color(1,0,0) would be red.

CherylLau
Esri Regular Contributor

Seems like you have your question answered, but for completeness, here's the help page and some further explanation.

color Operation

The help shows you three ways to set a color:

1) You can set the color by calling the color function with 3 parameters.  For example, color(1, 1, 1) sets the color to white. The first parameter specifies the red component, the second specifies the green component, and the third specifies the blue component.  Each of these parameters should be in the range [0,1].  A color is described by its red, green, and blue components.  When all the components have a value of 1, we get white.  When all are 0, we get black.  When all are the same, for example (0.7, 0.7, 0.7), we get some shade of gray.  Different combinations of r, g, and b values yield different colors.  If red is 1, then there is the maximum amount of red in the color, and if red is 0, then there is no red in the color.  If red=0.8, green=0, and blue=0.4, this means that there is half as much blue as there is red, and there is no green.  This is some shade of magenta/purple (mixture of blue and red with more red), but to know the exact color just from the numbers is very difficult.  To have a specific color in mind and to guess its rgb values is also very difficult.  Note that rgb values can also be described in the range [0,255] (not in CityEngine).  It is the same thing, but now 255 corresponds to 1.  The range is just scaled.  You can use webpages with color charts to find colors you want, or you can use a color picker in any tool on your computer since most software will display rgb and/or hex values.

2) You can set the color and opacity by calling the color function with 4 numbers.  This is the same as (1), but the fourth parameter is the opacity value, which describes how transparent the object should be.

3) You can set the color by calling the color function with a string.  This is a hex string that describes the color.  It starts with a # sign and is followed by 6 characters.  The first two characters represent red, the second two represent green, and the last two represent blue.  In “#ff0000”, the “ff” corresponds to the red component, green is “00”, and blue is “00”.  This means that the red component is at the max, and green and blue are both 0, making the color pure red.  Instead of having values from 0 to 1, hex uses values from 00 to ff.  In our number system, which is base 10, we have single digits that go from 0 to 9.  In a hex number system, the base is 16, and the digits are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f.  After the 9th digit, letters are used up to f.  So, for the each color component, successive values are 00, 01, 02, 03, 04, 05, 06, 07, 08, 09, 0a, 0b, 0c, 0d, 0e, 0f, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 1a, 1b, 1c, 1d, 1e, 1f, 20, … and so on until ff. Basically, it probably suffices to know the cc is a brighter color than aa which is brighter than 88 which is brighter than 33, for example.  Also, hex colors are hard to guess sometimes, so I would just look them up.

For colors it helps to know the following:

Black = (0, 0, 0) or “#000000”

White = (1, 1, 1) of “#ffffff”

Red = (1, 0, 0) or “#ff0000”

Green = (0, 1, 0) or “#00ff00”

Blue = (0, 0, 1) or “#0000ff”