diff options
Diffstat (limited to 'src/Color.ml')
-rw-r--r-- | src/Color.ml | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Color.ml b/src/Color.ml index b3d2f91..d2f74c4 100644 --- a/src/Color.ml +++ b/src/Color.ml @@ -27,10 +27,10 @@ let contrast_ratio (c1: rgb) (c2: rgb) = let from_raw color = let get_opt = function | Some x -> x | None -> raise (Invalid_argument "Option.get") in let div = H.div [| HA.style ("color: " ^ color) |] [| |] in - let body = Document.querySelectorUnsafe "body" in - let () = Element.appendChild body div in + let body = Document.query_selector_unsafe "body" in + let () = Element.append_child body div in let rgb = [%raw {| window.getComputedStyle(div).color |}] in - let () = Element.removeChild body div in + let () = Element.remove_child body div in let xs = Js.String.split ", " (get_opt (Js.String.splitByRe [%re "/[()]/"] rgb).(1)) in { r = Js.Float.fromString xs.(0) ; g = Js.Float.fromString xs.(1) |