Skip to content

[New feature] CCT - Correlated Color Temperature #111

Description

@heinemannj

Correlated Color Temperature (CCT) (in K)
Returns a correlated color temperature.

Option A:
Based on Bruce Justin Lindbloom's implementation
http://www.brucelindbloom.com/Eqn_XYZ_to_T.html

Option B:
based on McCamy cubic approximation
https://en.wikipedia.org/wiki/Color_temperature

var xyz65_Sum = xyz65.x + xyz65.y + xyz65.z;

if (xyz65_Sum !== 0) {
	xyY65.x = xyz65.x / xyz65_Sum;
	xyY65.y = xyz65.y / xyz65_Sum;
	xyY65.Y = xyz65.y;
} else {
	xyY65.x = 0;
	xyY65.y = 0;
	xyY65.Y = 0;
}

var n = (xyY65.x - 0.3320) / (0.1858 - xyY65.y);
var cct = (449.0 * Math.pow(n, 3)) + (3525.0 * Math.pow(n, 2)) + (6823.3 * n) + 5520.33;

Benefit of option B:

Caculation of xyY coordinates which are actually not covered by culori

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureNew feature or requestResearchFurther reading / things to look into

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions