Conversion between `oklch` and `okhsl`
- Dominant language
- JavaScript
- Stars
- 1.2k
- Forks
- 38
- PR merge metrics
- No merged PRs in 30d
Description
I was playing around with the library and `converter`. When attempted, conversion from `oklch` to `okhsl` yields weird results. In the documentation I haven't seen any specifics about the the color spaces supported by converter. So I assume it is expected to work.
This is my converter function.
``` javascript
function colorConverter(mode, colorObject) {
let convertFunction = converter(mode);
let convertedColor = convertFunction(colorObject);
return convertedColor;
}
```
I have added,
``` javascript
useParser("--oklch", "oklch");
```
The function call is,
``` javascript
let elemColour = colorConverter(colorModes[i], defaultColour);
```
In that `colorModes` is
``` javascript
let colorModes = ["okhsl", "oklch"];
```
and, `defaultColour` is,
``` javascript
let defaultColour = {
mode: "oklch",
l: 0.2,
c: 0.1,
h: 230,
};
```
this is the results I'm getting,

the values are,
``` javascript
Object { mode: "okhsl", l: 0.09907971332700131, s: -0.14929222272569598, h: 229.99999999999997 }
Object { mode: "oklch", l: 0.2, c: 0.1, h: 230 }
```
Is there anything I'm missing? Else it looks like there is some bug with converter function
Contributor guide
Assessment
This issue has not been assessed yet.