• tomloprod/colority: Colority is a lightweight PHP library designed to handle color transformations, validations and manipulations with ease.
    https://github.com/tomloprod/colority

    Colority is a lightweight #PHP #library designed to handle #color transformations, validations and manipulations with ease.

    It allows you to instantiate concrete objects according to the color format (RGB, HSL, Hexadecimal) and convert from one format to another.

    Additionally, it lets you check if a background color meets the WCAG 2.0 #accessibility standard regarding the color contrast ratio in text and UI.

    Furthermore, it includes multiple functions such as the following:

    – Generate the best foreground color (white, black, or from a user-provided list) for a background color, ensuring the best possible contrast ratio. (important for improving text visibility on, for example, colored badges).
    – Generate a fixed color based on a string. Useful for generating a color associated with, for example, a username.
    – Allows you to obtain a random color similar to a given color.

    via https://blog.jetbrains.com/phpstorm/2024/06/php-annotated-may-2024