tesk9/palette/1.0.0

NOTE: the latest version is 3.0.1

Color.Contrast

Use this module to determine whether colors may be used together.

= AA
| AAA

Read more about levels of conformance at WCAG.

-> { fontSize : Float
, fontWeight : Int
}
-> Color
-> Color
-> Bool

For a given WCAG level, calculate whether two colors have enough contrast with each other to be used together (e.g., as a background and text color combination).

To meet AA level sufficiently, follow these standards. To meet AAA level sufficiently, follow these standards.

TODO (consider this a headsup on likely API changes!):

  • Use named fontweights rather than numbers
  • Wrap fontsize with some constructors
  • Cassowary constraint solving..?
contrast : Color -> Color -> Float

Calculate the contrast between two colors.