Created
June 21, 2011 08:30
-
-
Save williamn/1037456 to your computer and use it in GitHub Desktop.
Converting HEX color (RRGGBB) to KML color (AABBGGRR)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
c c dc