Support OKLCH color space #1475
Labels
enhancement
Feature requests, and general improvements.
needs investigation
Needs further investigation.
Milestone
Lightweight Charts™ Version: 4.0.1, 4.1.1
The OKLCH color space has recently been introduced into all modern browsers, and while the colors work in some places, some places they do not. Here is one example of such a place.
Steps/code to reproduce:
Actual behavior:
Expected behavior:
Handle the new OKLCH color space everywhere.
colorStringToRgba
insrc/helpers/color.ts
seems to be where the conversion is done.Here is a fork adding support, however since I have no knowledge around color spaces, the conversion code is directly from ChatGPT, and I don't feel comfortable submitting that as a PR. I have tested it with a few colors, comparing to the values given by https://oklch.com/ and it does seem to function correctly, even for values outside of the RGB color space.
https://github.com/benphelps/lightweight-charts/tree/oklch
CodeSandbox/JSFiddle/etc link:
https://jsfiddle.net/ykpg8v7c/
The text was updated successfully, but these errors were encountered: