You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using the TypeScript version of the library, and as far as I can tell, the only way to specify an HCT color with a hue-chroma-tone triplet is as follows:
In other words, Hct.from creates an Hct object which, in default viewing conditions, has the specified hue, chroma, and tone — or, values that are as close to the specified ones as possible. No surprise there, it's mentioned in the method's documentation.
Problem
Now, I was trying to create a color palette for a specific set of viewing conditions, e.g.:
(Here, vc would correspond to the default viewing conditions except with the background L* set to 10 instead of the default of 50) (i.e., a darker background).
I want the colors in my palette to appear consistent in tone and chroma for these viewing conditions, not the default viewing conditions.
letcolor1=Hct.from(60,10,20);letcolor2=Hct.from(280,10,20);console.log(color1.inViewingConditions(vc).hue);// 60 vs 58.82148886264458console.log(color2.inViewingConditions(vc).hue);// 280 vs 282.2639993051888console.log(color1.inViewingConditions(vc).chroma);// 10 vs 5.977109516590248console.log(color2.inViewingConditions(vc).chroma);// 10 vs 6.3614473636394console.log(color1.inViewingConditions(vc).tone);// 20 vs 12.489930368768537console.log(color2.inViewingConditions(vc).tone);// 20 vs 12.480603303269618
As can be seen in the above example, this desired consistency is not guaranteed if the colors are defined with Hct.from. As a matter of fact, I don't know of any way to guarantee this consistency.
Suggestion
I would suggest adding an additional optional parameter to the Hct.from:
Introduction
I'm using the TypeScript version of the library, and as far as I can tell, the only way to specify an HCT color with a hue-chroma-tone triplet is as follows:
In other words,
Hct.from
creates anHct
object which, in default viewing conditions, has the specified hue, chroma, and tone — or, values that are as close to the specified ones as possible. No surprise there, it's mentioned in the method's documentation.Problem
Now, I was trying to create a color palette for a specific set of viewing conditions, e.g.:
(Here,
vc
would correspond to the default viewing conditions except with the background L* set to 10 instead of the default of 50) (i.e., a darker background).I want the colors in my palette to appear consistent in tone and chroma for these viewing conditions, not the default viewing conditions.
As can be seen in the above example, this desired consistency is not guaranteed if the colors are defined with
Hct.from
. As a matter of fact, I don't know of any way to guarantee this consistency.Suggestion
I would suggest adding an additional optional parameter to the
Hct.from
:The color could still be stored internally as the hue-chroma-tone triplet from the default viewing conditions, of course.
The text was updated successfully, but these errors were encountered: