let create name color = let c = Color.from_raw color in let crBlack = Color.contrast_ratio { r = 0.; g = 0.; b = 0. } c in let crWhite = Color.contrast_ratio { r = 255.; g = 255.; b = 255. } c in let textCol = if crBlack > crWhite then "black" else "white" in Leaflet.div_icon { className = "" ; popupAnchor = [| 0.; -34. |] ; html = H.div [| HA.class_ "g-Marker" |] [| H.div [| HA.class_ "g-Marker__Round" ; HA.style ("background-color: " ^ color) |] [| |] ; H.div [| HA.class_ "g-Marker__PeakBorder" |] [| |] ; H.div [| HA.class_ "g-Marker__PeakInner" ; HA.style ("border-top-color: " ^ color) |] [| |] ; H.div [| HA.class_ "g-Marker__Icon" |] [| H.i [| HA.class_ ("fa fa-" ^ name) ; HA.style ("color: " ^ textCol) |] [| |] |] |] }