Skip to content

Latest commit

 

History

History
186 lines (167 loc) · 7.27 KB

README.md

File metadata and controls

186 lines (167 loc) · 7.27 KB

color-cam16

Perceptual Color Space and Language based on the CAM16 Uniform Color Space

Defining and Manipulating Colors

color-cam16 is a TypeScript library for defining and manipulating colors. Generate color sequences. Define color relationships. Determine color differences. Find analogous and complimentary colors. Ensure color contrast. Match real world colors.

The library uses a uniform color space based on human perception and human semantics. You can define a set of colors by their relationships in plain text. Define colors as warmer, cooler, lighter, darker, stronger, weaker, analogous, triadic, or complimentary. Declare how many steps between colors to form color sequences. The library will parse the color description and generate a set of colors.

Color Language

parse_colors(text: string): CAM16u[]

require { parse_colors } import 'color-cam16'

color_gradient = parse_colors('1A5 to 9Z5 in 5 steps')
warm_colors = parse_colors('1A5 to 9Z5 in 15 steps')
cool_colors = parse_colors('9a5 to 1z5 in 15 steps')
rainbow = parse_colors('rainbow in 26 steps')
hue_A = parse_colors('0A0 lighter to 100 in 11 steps, stronger to 50 in 10 steps').filter(x => x.inGamut)

Color gradient

Warm colors

Cool Colors

Rainbow Colors

Hue A












  • adjust_color
{
    "Ju":70,
    "Mu":16.66,
    "Hu":32
    "inGamut":true,
    "hex":"#d8a488",
    "hexMu":16.666666666666664,
    "hexLabel1":"7N3",
    "hexLabel2":"70N33",
}

Color Space Transforms

  • JuMuHu_to_color
  • label_to_color

Color Space Analysis

  • delta_e
  • find_closest_color
  • find_strongest_color
  • find_strongest_Mu
  • cluster_colors

Color Names

  • label_to_name
  • name_to_color
  • find_closet_names