material-foundation / material-color-utilities

Color libraries for Material You
Apache License 2.0
1.57k stars 134 forks source link

Parametrize default viewing conditions in TS #117

Closed nvlang closed 7 months ago

nvlang commented 9 months ago

This pull request (which I'm aware you can't accept, but can hopefully still be of some use) proposes to parametrize the default viewing conditions with respect to which HCT colors are created. It would indirectly resolve https://github.com/material-foundation/material-color-utilities/issues/116.

The idea that the L* value used in the calculation of the adaptingLuminance should be independent from backgroundLstar stems from this method in the C++ library:

https://github.com/material-foundation/material-color-utilities/blob/12b75a01476c41bb2ba9c585cfc71f1a7692aa11/cpp/cam/viewing_conditions.cc#L97-L101

This independence seems odd to me at first glance, but I'm probably just missing something.