-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Functions for conversions between color spaces #80054
Description
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