Skip to content

Instantly share code, notes, and snippets.

@williamn
Created June 21, 2011 08:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save williamn/1037456 to your computer and use it in GitHub Desktop.
Save williamn/1037456 to your computer and use it in GitHub Desktop.
Converting HEX color (RRGGBB) to KML color (AABBGGRR)
# Taken from http://rcos.cs.rpi.edu/projects/flagship-safety/commit/converting-hex-color-rrggbb-to-kml-color-aabbggrr/
#
# Generates a KML color given a hex color string.
# Converts the format from #RRGGBB to AABBGGRR.
# The alpha channel defaults to ff.
def to_kmlcolor(color="#000000", alpha = "ff")
alpha + color[5,3] + color[3,2] + color[1,2]
end
@zhelinskyy
Copy link

c c dc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment