formatHex returns default color when converting from LCH
prjctimg opened this issue · 2 comments
I was trying to convert an LCH color object to a hex code. However the function only returns the default black color ('#000000').
Is this function only applicable on RGB color space or do I have to first manually convert the color to RGB first?
let bluered = interpolate(['blue','red'],'lch')
console.log(formatHex(bluered(0.5)))
=> Outputs '#000000' ```
This is what I get when running the code in the browser console on culorijs.org:
culori.formatHex(culori.interpolate(['blue', 'red'], 'lch')(0.5))
// => "#f50086"
Can you share more details on how you have the library set up?
I'm using the .mjs version of the bundled source. Directly importing the Library from node_modules causes an error :
[ERR_PACKAGE_PATH_NOT_EXPORTED] :Package subpath 'bundled/culori.mjs is not defined by exports in /path/to/package.json '
So I do a local import of the module outside of node_modules directory
import {interpolate,formatHex} from '../../src/culori.mjs'