package color

  1. Overview
  2. Docs
Convert between different color formats

Install

Dune Dependency

Authors

Maintainers

Sources

0.3.0.tar.gz
md5=8bb06d9bb169c29f17699fb93809db94
sha256=1ffa724cc16fe04aa253a8591eae26b22274f1492d64888f6fb8c2f7165cedbc

README.md.html

Color: conversions between different color formats

Color is a library that converts between different color formats. Right now it deals with RGB[A], HSL[A], OkLab, and Oklch formats. All those format convert to and from Gg.Color.t (from Gg).

The goal for this library is to provide easy handling of colors on the web, when working with js_of_ocaml.

Examples

The library uses the color type from Gg as a bridge between other models.

# Color.Rgb.(v 12 121 229 |> to_gg) |> Color.to_hexstring ;;
- : "#0c79e5"
# Gg.Color.red |> Color.Hsl.from_gg |> Color.Hsl.to_css ;;
- : string = "hsl(0.00 100.00% 50.00%)"

# Gg.Color.red |> Color.Rgb.from_gg |> Color.Rgb.to_css ;;
- : string = "rgb(255 0 0)"

# Gg.Color.red |> Color.complementary |> Color.to_hexstring ;;
- : string = "#00a9db"

Credit

Based on purescript-colors

OCaml

Innovation. Community. Security.