Standardizing RAL color values requires three steps: normalize the format to a consistent pattern (four digits, no prefix variations), validate that each code exists in the RAL Classic system, and enrich the record with the standard color name for display. The payoff is clean faceted search and accurate cross-supplier comparison.
The problem: color data is a mess
Pull a color attribute report from any electrical distributor's PIM and you will find chaos. Here is a real-world sample from a catalog with 40,000 SKUs:
| Raw value | Supplier | What they meant |
|---|---|---|
| RAL 7035 | Rittal | Light grey |
| 7035 | Hager | Light grey |
| RAL7035 | Schneider Electric | Light grey |
| lichtgrau (RAL 7035) | Weidmuller | Light grey |
| Light Grey | Phoenix Contact | Probably RAL 7035 |
| gris clair | Legrand | Probably RAL 7035 |
| #C5C7C4 | Webshop import | Hex approximation of RAL 7035 |
| RAL 7035/7016 | Eaton | Two-tone enclosure |
| similar to RAL 7035 | Chinese supplier | Not exactly RAL 7035 |
Nine different representations of what should be a single filterable value. Multiply this by 50 colors and 200 suppliers and you understand why color search on most distributor websites is effectively broken.
Step 1: Extract the RAL code
The first step is extracting a four-digit RAL code from whatever the supplier sent. This is a pattern matching problem.
Patterns to match
Most supplier color values fall into one of these patterns:
- Explicit RAL code: "RAL 7035," "RAL7035," "RAL-7035," "ral 7035" -- extract the four digits after the RAL prefix.
- Bare four-digit code: "7035" -- check whether it is a valid RAL Classic code.
- RAL code embedded in text: "lichtgrau (RAL 7035)" or "Light grey / RAL 7035" -- extract the RAL code with a regex.
- Multiple RAL codes: "RAL 7035/7016" or "RAL 7035 + RAL 9005" -- this is a multi-color product. Extract both codes and store them as a list.
- Free text color name: "Light Grey," "gris clair," "anthrazit" -- map to RAL codes using a lookup table.
- Hex value: "#C5C7C4" -- map to the nearest RAL code using color distance calculation (but flag as approximate).
A simple regex like RAL\s*[-]?\s*(\d{4}) catches patterns 1 through 3. Pattern 4 requires splitting on delimiters. Patterns 5 and 6 require lookup tables.
Building a color name lookup table
For free-text color names, build a mapping table that covers the common names in English, German, French, and Italian:
| Free text variations | RAL Code |
|---|---|
| light grey, light gray, lichtgrau, gris clair, grigio chiaro | 7035 |
| anthracite, anthrazit, anthracite grey, gris anthracite | 7016 |
| pure white, reinweiss, blanc pur | 9010 |
| jet black, tiefschwarz, noir fonce | 9005 |
| signal yellow, signalgelb, jaune signal | 1003 |
This table does not need to be comprehensive. Focus on the 20-30 colors that cover 95% of your electrical product catalog. The long tail (unusual colors for custom orders) can be handled manually.
Step 2: Validate the RAL code
Not every four-digit number is a valid RAL Classic code. After extraction, validate each code against the RAL Classic register.
Common invalid codes that appear in real catalogs:
| Invalid code | Probable cause | Correct code |
|---|---|---|
| RAL 7034 | Typo for RAL 7035 | RAL 7035 (light grey) |
| RAL 7099 | Fabricated | Does not exist |
| RAL 210 50 35 | RAL Design code, not Classic | Convert or flag |
| RAL 070 80 60 | RAL Design code | Convert or flag |
| RAL 5000 | Sounds plausible but check | Valid (violet blue) |
Use the free RAL color validator to verify codes. It checks whether the four-digit code exists in the RAL Classic system and returns the standard color name.
Handling near-misses
When a code fails validation and the first digit is correct (correct color range), check for transposition errors. RAL 7053 is valid (pearl mouse grey) but RAL 7503 is also valid (moss grey). A human reviewer can usually determine the correct code from the product photo or specification context.
Step 3: Normalize the format
Once you have a validated four-digit code, store it in a consistent format. Choose one canonical representation and apply it everywhere:
Recommended format: RAL 7035
- Uppercase "RAL"
- Single space
- Four digits
- No hyphens, no trailing text
This format is human-readable, sort-friendly, and unambiguous. Store the code and the standard color name in separate fields:
color_code: "RAL 7035"
color_name: "Light grey"
The color name field enables display in the user's language. The code field enables exact matching and faceted search.
Step 4: Handle multi-color products
Some electrical products have two or more RAL colors. A two-tone enclosure might be RAL 7035 (body) with a RAL 7016 (door). A control panel might have RAL 7035 sides and a RAL 5010 door.
Store multi-color products with a structured format:
{
"primary_color": "RAL 7035",
"secondary_color": "RAL 7016",
"color_description": "Light grey body, anthracite grey door"
}
For faceted search, index both color codes so the product appears in results for either RAL 7035 or RAL 7016.
Step 5: Handle hex approximations
If your webshop displays color swatches, you need hex approximations for rendering. But hex values should be derived from the RAL code, not the other way around.
Maintain a single mapping table from RAL codes to hex values. Use the same hex value consistently across all products with the same RAL code. Do not store supplier-provided hex values, because different suppliers provide different approximations for the same RAL color.
| RAL Code | Standard hex | Notes |
|---|---|---|
| RAL 7035 | #C5C7C4 | Approximate, monitor-dependent |
| RAL 7016 | #383E42 | Approximate |
| RAL 9010 | #F1ECE1 | Approximate |
| RAL 9005 | #0E0E10 | Approximate |
These hex values are display-only approximations. The product specification is the RAL code, not the hex value.
Measuring the impact
After normalization, measure two things:
-
Color fill rate. What percentage of products that should have a RAL code now have a validated one? Target: 95%+ for enclosures, cabinets, cable management, and luminaires.
-
Search accuracy. Run a test search for "RAL 7035 enclosure." How many results appear compared to before normalization? The number should increase (because products with variant spellings are now findable) and the precision should improve (because invalid codes are removed).
Color normalization is one of the highest-ROI data quality projects for electrical distributors. The work is finite (20-30 color codes cover most products), the rules are deterministic, and the search improvement is immediately visible to customers.
Validate your entire color dataset in bulk with the RAL color validator to identify which codes need correction before you publish.
