Using color code...

2,255 views
Skip to first unread message

Cansın

unread,
May 17, 2009, 8:23:31 AM5/17/09
to KML Developer Support - Getting Started with KML
Hey there coders :)

i want to ask you all how can i add a color value to my KML file..

by the way this is my code to generate a color but i could't finish
the end :)

style.LineStyle.Color = ??????????? ;

Please fill the " ? " 's ....

thanx

Nymor

unread,
May 17, 2009, 6:11:33 PM5/17/09
to KML Developer Support - Getting Started with KML
Hi,

From the KML reference
http://code.google.com/apis/kml/documentation/kmlreference.html#color

"Color and opacity (alpha) values are expressed in hexadecimal
notation. The range of values for any one color is 0 to 255 (00 to
ff). For alpha, 00 is fully transparent and ff is fully opaque. The
order of expression is aabbggrr, where aa=alpha (00 to ff); bb=blue
(00 to ff); gg=green (00 to ff); rr=red (00 to ff). For example, if
you want to apply a blue color with 50 percent opacity to an overlay,
you would specify the following: <color>7fff0000</color>, where
alpha=0x7f, blue=0xff, green=0x00, and red=0x00."

Search for HTML Colour Charts which will give you loads of sites
listing various standard/well used codes ... just remember that they
will show them in RGB format so you need to swap them around to BGR
for Google Earth and add the alpha value at the front.

HTML = 123456
GE = aa563412

A colour in KML might look like...

<bgColor>ffd5efff</bgColor>

Hope that helps.

Regards
Nymor

Dylan

unread,
May 18, 2009, 11:22:45 AM5/18/09
to KML Developer Support - Getting Started with KML
I would love some insight on the swapping thing if anyone has some.
Why ABGR instead of RGBA? What's the reasoning behind that?

dylan

On May 17, 4:11 pm, Nymor wrote:
> Hi,
>
> From the KML referencehttp://code.google.com/apis/kml/documentation/kmlreference.html#color

Cansın

unread,
May 18, 2009, 5:27:01 PM5/18/09
to KML Developer Support - Getting Started with KML
Hey Nymor,

thanx for your kind help but actually i found the solution kind a
different way :) thanx for your help again. See u with an another
question ;)
By the way Dylan i search that interesting stuff why REVERSE? i
couldn't find any logical idea =)) keep on searching and guessing lol

Bye
Cansin
Reply all
Reply to author
Forward
0 new messages