I'm using simple_kml library to generate a kml file with data sent from drawing manager on google Maps using Javascript, everything goes fine except the color of the shape .. the color send in this format #ec0909, and here is how am trying to add it to the shape:
ls = kml.newlinestring(name="Polyline")
ls.coords = [(latlng['lng'], latlng['lat']) for latlng in shape['coordinates']]
ls.description = shape['info_box']
print(f"THE COLOR IS {color_code}") #returns #ec0909
ls.style.polystyle.color = color_code
as you see the color should be red .. but it is shown as blue/red shaded color.


color_codeneeds to not contain the pound sign character; your comment makes it seem like that string is#ec0909but it needs to beec0909. Beyond that, you’re working on akml.LineStringobject and not akml.Polygonobject, so I think you need to set the color usingls.style.linestyle.colorinstead ofls.style.polystyle.color.Hope that helps,
—K
EDIT: see more here and consider you may need to convert a hex string using
kml.Color.hex()in your assignment, or include alpha codes to makecolor_codeinto the stringec0909ff.