Skip to content

Support RAL and FS595C color formats #180

@jbingram

Description

@jbingram

Is your feature request related to a problem? Please describe.
Add options for color code systems like RAL (standard in Europe), Federal Standard 595C colour range (standard in the US)

Describe the solution you'd like

  1. Set a database of correspondance between codes: RAL or FS595C <-> RGB or HEX or CIELAB

The model of conversion could be based e.g. on CIELAB -> RAL (Classic or design ...) using this website: https://convertingcolors.com/ral-colors.html

  1. Color Matching Algorithms:

Color conversion between systems like RGB/HEX and RAL or FS595C is typically done through color-matching algorithms, which compare the input color to a database of standard colors and return the closest match. This can be achieved by:

  • Euclidean Distance in Color Space: Calculate the distance between the input color in RGB or another color space (e.g., Lab) and the colors in the RAL or FS595C database. Formula for Euclidean distance in RGB:

$$ \text{Distance}_{RGB} = \sqrt{(R_1 - R_2)^2 + (G_1 - G_2)^2 + (B_1 - B_2)^2} $$

  • More accurate matches are obtained using the CIE Lab color space (that Eyedropper already provides), as it models human perception better:

$$ \Delta E_{76} = \sqrt{(L_1 - L_2)^2 + (a_1 - a_2)^2 + (b_1 - b_2)^2} $$

Delta E (CIEDE2000): A perceptual metric used for assessing color differences, which is more complex but provides more reliable results than Euclidean distance:

$$ \Delta E_{00} = \sqrt{ \left( \frac{\Delta L'}{k_L S_L} \right)^2 + \left( \frac{\Delta C'}{k_C S_C} \right)^2 + \left( \frac{\Delta H'}{k_H S_H} \right)^2 + R_T \frac{\Delta C'}{k_C S_C} \frac{\Delta H'}{k_H S_H} } $$

  1. There are software tools and APIs available for this task:

Open-source libraries: Some libraries in Python (e.g., colormath, Pillow) can help convert colors between RGB, Lab, and other spaces, making it easier to calculate the nearest match.

Describe alternatives you've considered
#NA

Additional context
#NA

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions