Skip to content

How do you convert RGB to OKLCH? #251

Description

@NullVoxPopuli

Testing some symmetric conversion to make sure things are what I expect

I'm just testing things out on the docs site here: https://culorijs.org/api/#formatHex
in the browser console.

image

culori.formatHex(culori.parseHex('#0074ff'))
// "#0074ff" 

culori.formatHex(culori.convertRgbToLab(culori.parseHex('#0074ff')))
// "#0074ff"  

culori.formatHex(
  culori.convertLabToLch(
    culori.convertRgbToLab(
      culori.parseHex('#0074ff')
    ), 
    'oklch'
  )
)
// "#ff00ff" -- wrong

in that last one, if I omit the oklch argument, which converts to regular lch, formatHex returns the original hex, as expected

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions