TomSchimansky / TkinterMapView

A python Tkinter widget to display tile based maps like OpenStreetMap or Google Satellite Images.
Creative Commons Zero v1.0 Universal
621 stars 85 forks source link

Set colour lines with RGB #57

Closed hleclere closed 1 year ago

hleclere commented 1 year ago

Hello,

Thank you for TkinterMapView that is a very nice project.

I am a geologist and I would like to draw faults on maps and to set the colour of the line based on their dip.

I would like to use RGB value to set the colour of the line and to make my own colourbar.

Is it possible to do it ? or do you have other suggestion on how to do it ?

Best regards

Henri

TomSchimansky commented 1 year ago

Here are two functions you can use to easily convert between hex and rib:

def rgb2hex(r,g,b):
    return "#{:02x}{:02x}{:02x}".format(r,g,b)

def hex2rgb(hexcode):
    return tuple(map(ord,hexcode[1:].decode('hex')))