Skip to content

colorjs/color-space

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
January 24, 2022 20:15
January 24, 2022 19:54
June 25, 2023 15:39
February 1, 2016 15:42
June 3, 2015 12:08
June 25, 2023 15:32
July 8, 2021 21:21
July 8, 2021 21:21
July 8, 2021 21:21
July 8, 2021 21:21
July 8, 2021 21:21
January 24, 2022 19:46
July 8, 2021 21:21
July 8, 2021 21:21
January 24, 2022 19:46
January 24, 2022 22:36
July 8, 2021 21:21
July 8, 2021 21:21
July 8, 2021 21:21
July 8, 2021 21:21
January 24, 2022 19:54
July 8, 2021 21:21
July 8, 2021 21:21
July 8, 2021 21:21
July 8, 2021 21:21
July 8, 2021 21:21
July 8, 2021 21:21
July 8, 2021 21:21
July 8, 2021 21:21
July 8, 2021 21:21
June 25, 2023 15:39
June 25, 2023 15:39
July 8, 2021 21:21
June 25, 2023 15:39
July 8, 2021 21:21
July 8, 2021 21:21
July 8, 2021 21:21
July 8, 2021 21:21
July 8, 2021 21:21
July 8, 2021 21:21
July 8, 2021 21:21
July 8, 2021 21:21
July 8, 2021 21:21
July 8, 2021 21:21
July 8, 2021 21:21
July 8, 2021 21:21
January 24, 2022 19:46

Color-space test stable npm size

Collection of color spaces conversions & data.

Demo.

Usage

import space from 'color-space';

//convert lab to lch
var result = space.lab.lch([80,50,60]);

Spaces can be imported separately:

import rgb from 'color-space/rgb.js';
import hsl from 'color-space/hsl.js';

//convert rgb to hsl
rgb.hsl([200,230,100]);

API

<fromSpace>.<toSpace>(array);
<space>.name //space name
<space>.min //channel minimums
<space>.max //channel maximums
<space>.channel //channel names
<space>.alias //alias space names

Spaces

Contribute

Please fork, add color space with basic conversions to/from XYZ or RGB and tests. The goal of the project is the most complete set of color spaces with minimal uniform API.

Credits

Thanks to all scientists, who devoted their time to color research and conveyed their knowledge, for now we can use their formulas and code.

Alternatives

See also

  • color-api - color API proposal by Lea Verou