usolved / cie-rgb-converter

A JavaScript file that provides functions to convert the CIE (XYZ) color space to the RGB color space and vice versa.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cie-rgb-converter

Overview

This script provides two functions to convert the CIE (XYZ) color space to the RGB color space and vice versa.

The developer documentation for Philips Hue provides the formulas used in this script: https://developers.meethue.com/documentation/color-conversions-rgb-xy

I've used the formulas and Objective-C example code and transfered it to JavaScript.

Installation

Just include the cie_rgb_converter.js file to your HTML page:

<script src="cie_rgb_converter.js"></script>

Examples

Convert CIE to RGB

var rgb = cie_to_rgb(0.6611, 0.2936)

Convert RGB to CIE

var cie = rgb_to_cie(255, 39, 60)

Authors

Ricardo Klement (www.usolved.net)

About

A JavaScript file that provides functions to convert the CIE (XYZ) color space to the RGB color space and vice versa.

License:MIT License


Languages

Language:JavaScript 100.0%