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
| 4 |
+
- en
|
| 5 |
+
- fr
|
| 6 |
+
tags:
|
| 7 |
+
- color
|
| 8 |
+
- color-normalization
|
| 9 |
+
- multilingual
|
| 10 |
+
- ecommerce
|
| 11 |
+
- text-classification
|
| 12 |
+
pretty_name: Color Names Normalized
|
| 13 |
+
size_categories:
|
| 14 |
+
- 10K<n<100K
|
| 15 |
+
task_categories:
|
| 16 |
+
- text-classification
|
| 17 |
+
configs:
|
| 18 |
+
- config_name: default
|
| 19 |
+
data_files:
|
| 20 |
+
- split: train
|
| 21 |
+
path: data/colors_normalized.parquet
|
| 22 |
+
---
|
| 23 |
+
|
| 24 |
+
# Color Names Normalized
|
| 25 |
+
|
| 26 |
+
A dataset for normalizing messy, multilingual, free-text color names to a
|
| 27 |
+
small, fixed vocabulary. Real-world `color` attributes — product feeds,
|
| 28 |
+
marketplace listings, survey answers — are free text with thousands of
|
| 29 |
+
variants. This dataset maps **38,112 real-world color names** (English and
|
| 30 |
+
French) to a strict **20-color base palette** — e.g. `"rouge"`, `"dark navy"`,
|
| 31 |
+
`"burgundy"`, `"whispering grasslands"` all resolve to a canonical base color
|
| 32 |
+
— so color data becomes groupable, filterable, and analyzable.
|
| 33 |
+
|
| 34 |
+
Each color name comes with its hex code and was assigned to the perceptually
|
| 35 |
+
closest palette color using the **CIEDE2000** color-difference formula in
|
| 36 |
+
CIELAB space (D65).
|
| 37 |
+
|
| 38 |
+
## Use cases
|
| 39 |
+
|
| 40 |
+
- **E-commerce catalogs**: power color filters and facets from free-text
|
| 41 |
+
product attributes instead of maintaining hand-written mapping tables.
|
| 42 |
+
- **Analytics**: aggregate sales or inventory by 20 base colors rather than
|
| 43 |
+
thousands of vendor-specific shade names.
|
| 44 |
+
- **Search & matching**: treat `"navy"`, `"midnight"`, and `"bleu marine"`
|
| 45 |
+
as the same bucket for retrieval, dedup, or entity matching.
|
| 46 |
+
- **ML features**: turn a high-cardinality text column into a clean
|
| 47 |
+
20-class categorical feature.
|
| 48 |
+
|
| 49 |
+
## Quick start
|
| 50 |
+
|
| 51 |
+
```python
|
| 52 |
+
import pandas as pd
|
| 53 |
+
|
| 54 |
+
# Load directly from the Hub
|
| 55 |
+
df = pd.read_parquet(
|
| 56 |
+
"hf://datasets/NacerKr/colors-normalized/data/colors_normalized.parquet"
|
| 57 |
+
)
|
| 58 |
+
|
| 59 |
+
# Build a normalization lookup: messy name -> base color
|
| 60 |
+
lookup = df.set_index(["name", "language"])["base_color"]
|
| 61 |
+
lookup.loc[("rouge", "fr")] # 'red'
|
| 62 |
+
lookup.loc[("burgundy", "en")] # 'brown'
|
| 63 |
+
```
|
| 64 |
+
|
| 65 |
+
Or with the `datasets` library:
|
| 66 |
+
|
| 67 |
+
```python
|
| 68 |
+
from datasets import load_dataset
|
| 69 |
+
|
| 70 |
+
ds = load_dataset("NacerKr/colors-normalized", split="train")
|
| 71 |
+
```
|
| 72 |
+
|
| 73 |
+
Names in the dataset are lowercased and whitespace-normalized — apply
|
| 74 |
+
`.str.strip().str.lower()` (and collapse inner whitespace) to your raw
|
| 75 |
+
`color` values before joining.
|
| 76 |
+
|
| 77 |
+
## Schema
|
| 78 |
+
|
| 79 |
+
| Column | Type | Description |
|
| 80 |
+
|---|---|---|
|
| 81 |
+
| `name` | string | Color name, lowercased and whitespace-normalized |
|
| 82 |
+
| `hex` | string | Hex code of the named color, uppercase `#RRGGBB` |
|
| 83 |
+
| `language` | string | `en` or `fr` |
|
| 84 |
+
| `source` | string | `color-names`, `color-pedia`, or `french-gist` |
|
| 85 |
+
| `base_color` | string | Assigned base palette color (one of 20 labels) |
|
| 86 |
+
| `base_hex` | string | Hex code of the assigned base color |
|
| 87 |
+
| `delta_e` | float32 | CIEDE2000 distance between `hex` and `base_hex` (0 = exact) |
|
| 88 |
+
|
| 89 |
+
**38,112 rows** — 37,877 English, 235 French. Median ΔE₀₀ to the assigned
|
| 90 |
+
base color is 12.4 (p90 = 19.6). Unique on (`name`, `language`).
|
| 91 |
+
|
| 92 |
+
## Base palette (20 labels)
|
| 93 |
+
|
| 94 |
+
The palette is the `basic` palette from
|
| 95 |
+
[colorjs/color-namer](https://github.com/colorjs/color-namer/blob/master/lib/colors/basic.js)
|
| 96 |
+
(MIT), minus `fuchsia`, which is an exact duplicate of `magenta` (`#FF00FF`).
|
| 97 |
+
|
| 98 |
+
| Label | Hex | | Label | Hex |
|
| 99 |
+
|---|---|---|---|---|
|
| 100 |
+
| black | `#000000` | | tan | `#D2B48C` |
|
| 101 |
+
| blue | `#0000FF` | | violet | `#EE82EE` |
|
| 102 |
+
| cyan | `#00FFFF` | | beige | `#F5F5DC` |
|
| 103 |
+
| green | `#008000` | | gold | `#FFD700` |
|
| 104 |
+
| teal | `#008080` | | magenta | `#FF00FF` |
|
| 105 |
+
| turquoise | `#40E0D0` | | orange | `#FFA500` |
|
| 106 |
+
| indigo | `#4B0082` | | pink | `#FFC0CB` |
|
| 107 |
+
| gray | `#808080` | | red | `#FF0000` |
|
| 108 |
+
| purple | `#800080` | | white | `#FFFFFF` |
|
| 109 |
+
| brown | `#A52A2A` | | yellow | `#FFFF00` |
|
| 110 |
+
|
| 111 |
+
## Methodology
|
| 112 |
+
|
| 113 |
+
1. **Merge** three permissively-licensed color-name sources (below) into
|
| 114 |
+
(`name`, `hex`) pairs tagged with `language` and `source`.
|
| 115 |
+
2. **Clean**: lowercase and whitespace-normalize names; validate and
|
| 116 |
+
normalize hex to uppercase `#RRGGBB`; drop junk names that embed raw hex
|
| 117 |
+
codes (~15k generation artifacts in color-pedia); deduplicate on
|
| 118 |
+
(`name`, `language`) with source priority `color-names` → `color-pedia` →
|
| 119 |
+
`french-gist`.
|
| 120 |
+
3. **Assign**: convert every hex and the 20 palette anchors from sRGB to
|
| 121 |
+
CIELAB (D65 white point), compute the full N×20
|
| 122 |
+
[CIEDE2000](http://www2.ece.rochester.edu/~gsharma/ciede2000/) distance
|
| 123 |
+
matrix in one vectorized numpy pass, and take the argmin. The CIEDE2000
|
| 124 |
+
implementation is validated against the Sharma et al. (2005) published
|
| 125 |
+
test pairs.
|
| 126 |
+
|
| 127 |
+
## Sources & attribution
|
| 128 |
+
|
| 129 |
+
| Source | Contribution | License |
|
| 130 |
+
|---|---|---|
|
| 131 |
+
| [boltuix/color-pedia](https://huggingface.co/datasets/boltuix/color-pedia) | English color names + hex | MIT |
|
| 132 |
+
| [BatteRaquette58/color-names](https://huggingface.co/datasets/BatteRaquette58/color-names) (derived from [meodai/color-names](https://github.com/meodai/color-names)) | English color names + hex | MIT |
|
| 133 |
+
| [angelodlfrtr's french_colors.json gist](https://gist.github.com/angelodlfrtr/bc39dc5d63ee330ac432f81b5e03eec6) | French color names + hex | not stated (attribution given) |
|
| 134 |
+
| [colorjs/color-namer](https://github.com/colorjs/color-namer) | 20-label base palette | MIT |
|
| 135 |
+
|
| 136 |
+
The [EPFL Multi-lingual Color Thesaurus](https://www.epfl.ch/labs/ivrl/research/image-mining/multi-lingual-color-thesaurus/)
|
| 137 |
+
was evaluated as an additional French source but deliberately **excluded**:
|
| 138 |
+
its CC BY-NC-SA 3.0 license (non-commercial) is incompatible with commercial
|
| 139 |
+
use.
|
| 140 |
+
|
| 141 |
+
## Limitations
|
| 142 |
+
|
| 143 |
+
- **Nearest-anchor artifacts**: assignment is purely geometric against 20
|
| 144 |
+
fixed anchor points. A few results differ from human intuition — e.g.
|
| 145 |
+
`navy blue` (`#000080`) lands on `indigo` rather than `blue`, and some
|
| 146 |
+
saturated pinks land on `violet`/`magenta` because the `pink` anchor
|
| 147 |
+
(`#FFC0CB`) is very pale. Use `delta_e` as a confidence signal (larger =
|
| 148 |
+
less certain).
|
| 149 |
+
- **French coverage is small** (235 names) relative to English.
|
| 150 |
+
- Names are lowercased; match case-insensitively against your raw data.
|
| 151 |
+
|
| 152 |
+
## License
|
| 153 |
+
|
| 154 |
+
Released under the [MIT License](https://opensource.org/licenses/MIT).
|