Skip to content

munsell.js is a library for handling Munsell Color System

License

Notifications You must be signed in to change notification settings

privet-kitty/munsell.js

Repository files navigation

munsell.js - A Library for Handling the Munsell Color System

Build Status Coverage Status

munsell.js is a JavaScript library primarily focused on converting colors between the Munsell Color System and other color spaces (e.g., RGB).

API Reference provides the detailed information beyond this README.

Getting started

Install

$ npm install munsell

Import

ES module

import * as munsell from 'munsell';

munsell.munsellToRgb255('2.3YR 6.7/4.22');
// => [ 201, 156, 135 ]

CommonJS

const munsell = require('munsell');

munsell.hexToMhvc('#ABCDEF');
// => [ 73.43648829473781, 8.05763439330249, 5.304123165279228 ]

Mechanism

munsell.js represents Munsell colors in two formats: as strings or as triplets of numbers. These formats can be recognized by the function name used. The string format, munsell, follows the standard string specification of Munsell colors, e.g., "4.2RP 3/11", "N 10". The triplet format, mhvc (Munsell Hue, Value, Chroma), expresses colors as three numbers: e.g., [94.2, 3, 11], [0, 10, 0].

The foundation of this library is the Munsell Renotation Data, which assumes the standard illuminant C as the light source. munsell.js employs the Bradford transformation for chromatic adaptation to other illuminants (e.g., D65).

munsell.js inter- and extrapolates the data via LCHab space, the method of which is in common with dufy, my color library for Common Lisp. The inversion from LCHab to Munsell colors is based on a method proposed by Paul Centore. For more information, refer to the following article.

  • Centore, Paul. (2012). An open-source inversion algorithm for the Munsell renotation. Color Research & Application. 37. 10.1002/col.20715.

Example

https://privet-kitty.github.io/albert/ This is a simple web app that uses munsell.js. It is a training tool to guess the Munsell code of a displayed color.

Copyright

Copyright (c) 2018-2024 Hugo Sansaqua.

About

munsell.js is a library for handling Munsell Color System

Resources

License

Stars

Watchers

Forks

Packages

No packages published