Problem/Motivation

Following the work started in #3257274: Implement color changing theme settings for Olivero and #788332: Provide a parser for THEME.colors.yml, it seems Drupal could benefit from utilizing a 3rd party library that can convert colors between various formats (e.g. hex codes, hsl, rgb).

From @alexpott's MR comments on the Olivero color picker:

I think given we're storing this in config I think maybe we should be storing the hsl value and not the hex. Since we need to call this for every html page served. ... we'd then need an hsl to rbg converter function to convert from the hsl function in config to rgb for the color picker. Ho hum.

Proposed resolution

Add spatie/color as a composer dependency of core. It has no run-time dependencies and is MIT licensed

At this point I'm not sure what else would be required, but I wanted to get the discussion going on this topic.

Comments

andy-blum created an issue. See original summary.

Version: 10.0.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.