Skip to content

Functions for conversions between color spaces #80054

@alexey-milovidov

Description

@alexey-milovidov

Company or project name

ClickHouse

Use case

ClickHouse is used to analyze scientific and raster data visually. See https://adsb.exposed/ as an example.

Describe the solution you'd like

Add two functions:

colorSRGBToOkLCH
colorOkLCHToSRGB

These functions take a three-element tuple of floating-point values (or values of other numeric types, which are converted to floating-point internally), and an optional value of gamma (by default it is set to 2.2), and return a three-element tuple.

It can return out-of-range values, such as values less than zero or more than 256 for RGB. Saturation and rounding are the responsibility of the caller. It can also accept out-of-range values.

See https://oklch.com/

Describe alternatives you've considered

It is doable with SQL UDF.

Additional context

No response

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions