Download the PHP package carbon/colorpicker-oklch without Composer
On this page you can find all versions of the php package carbon/colorpicker-oklch. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package colorpicker-oklch
Carbon.ColorPicker.OKLCH
Color picker for Neos CMS who saves the color in the OKLCH
color space. It also provide an eel helper to convert
HEX
colors to OKLCH
.
There are many options on how the picker should look like:
Here you can see some of the combinations:
Installation
Carbon.ColorPicker.OKLCH
is available via packagist.
Run the following command in your site package
Then run composer update
in your project root.
How the value get stored
Mode all
If the mode
ist set to all
(which is the default), the color picker don't store only the given value, it stores an array with following values:
hex
: The color in hex formatoklch
: The color in theOKLCH
color spacecoords
: The values in theOKLCH
color space. This is great for any color transformation. Very handy if you use something like the Tailwind OKLCH PlugincustomProperty
: Ready to use custom properties for your CSS. You can set the name via the optioncustomPropertyName
, defaults tocolor
Mode coords
If the mode
ist set to coords
, the color picker stores the coordinates of the OKLCH
color as array:
Mode hex
If the mode
ist set to hex
, the color picker stores the hex color value: #65a30d
Mode oklch
If the mode
ist set to oklch
, the color picker stores the OKLCH
color as string: oklch(64.817% 0.17545 131.68)
Settings
Add a property of type array and configure the editor as seen in this example:
If you set mode to hex
or oklch
the type has to be string
:
Customization
The editor allows some global default options via your Settings.yaml
file:
The settings can also be set in your property configuration:
Eel helper
ColorConvert.toOkLch(color, precision, customPropertyName)
Converts a HEX
color to the object who is used when you set the mode to all
.
color
(string|array, required) The colorprecision
(int) The precision for the color, defaults to5
customPropertyName
(string) The name for the ready to use custom property, defaults to'color'
Example:
returns