package color

All checked builds pass
  1. Overview
  2. Docs

Description

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]

Added to opam-repository:

README

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

Dependencies (3)

  1. gg >= "1.0.0"
  2. ocaml >= "4.08.0"
  3. dune >= "2.0"

Dev Dependencies (3)

  1. ocamlformat = "0.26.2" & with-dev-setup
  2. ocaml-lsp-server with-dev-setup
  3. alcotest with-test

Optional Dependencies

None

Conflicts

None

Build status

Results of building color with each compiler on check.ci.ocaml.org, run of against opam-repository 7cdc698. All results for this package.

Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.

Version OCaml 4.11 OCaml 4.14 OCaml 5.2 OCaml 5.4 OCaml 5.5
0.3.0 (this version) good good good good good
  • good Package successfully built
  • partial One of the dependencies failed to build
  • bad Package failed to build
  • n/a Package is not available in this environment
  • internal Internal failure