NumColor Fixes FLUX's Colorblindness to Hex Codes, Jumping From 13% to 55%
A new plug-in framework teaches diffusion models to read hex codes and RGB values, boosting numerical color accuracy 4 to 9 times.
ProTakeaways
- NumColor makes diffusion models understand hex and RGB codes by fixing subword tokenization and embedding gaps.
- A 6,707-entry ColorBook maps colors to text encoder space using perceptually uniform CIE Lab coordinates.
- Trained on FLUX only, transfers zero-shot to SD3, SD3.5, PixArt-α, and PixArt-Σ through shared T5 encoder.
- Numerical color accuracy improves 4-9x on GenColorBench; color harmony improves 10-30x across five models.
- Training uses a synthetic 500K-image dataset rendered in Blender with exact color-to-pixel correspondence.
- Remaining failures: color leakage into backgrounds and memory-color bias for objects like bananas or sunflowers.
Ask FLUX or Stable Diffusion 3 for a car painted #FF5733 and you will almost certainly get something else. Sometimes yellow. Sometimes a rainbow. Sometimes a beige backpack when you wanted a bright orange one. A group of researchers from the Computer Vision Center in Barcelona and City University of Hong Kong just published NumColor, a framework that finally makes text-to-image models take numerical color codes seriously, and it works across five different diffusion architectures without retraining.
Why diffusion models are colorblind to hex codes
The failure has an unglamorous root cause: tokenization. Subword tokenization fragments color codes into semantically meaningless tokens that text encoders cannot map to coherent color representations. A hex string like #FF5733 gets chopped into #, FF, 57, 33, and each fragment then attends to unrelated regions of the image during cross-attention. There is no single embedding that says orange.
The scale of the problem is well documented. Models reliably respond to coarse color descriptions such as basic color names like red, but their performance degrades severely when conditioned on numeric color codes. On the GenColorBench numerical color task, state-of-the-art models score below 15% accuracy, and FLUX manages only 13.82% on the coarsest 13-category test, barely above the 7.7% random baseline.

Two components, one plug-in fix
NumColor attacks the problem with two lightweight modules that sit in front of a frozen diffusion model:
- Color Token Aggregator (CTA): a character-level sequence labeler that detects hex and RGB spans regardless of how the tokenizer chopped them up. It uses a character-embedding CNN feeding a 4-layer transformer, then a CRF layer that tags each token with Begin/Inside/Outside labels. Total size: about 1.2M parameters.
- ColorBook: a codebook containing 6,707 learnable embeddings that map colors to the embedding space of the text encoder in perceptually uniform CIE Lab space. Each anchor is a 3D Lab coordinate paired with a 4096-dim embedding that matches T5's hidden size.
The choice of Lab over RGB matters. Euclidean distance in Lab actually corresponds to how different two colors look to a human, which RGB does not. The authors sample the Lab space on a 5-unit grid, filter to points inside the sRGB gamut, and end up with 6,707 anchors, roughly three orders of magnitude smaller than storing an embedding per RGB value.
Making the embedding space behave like a color wheel
A codebook alone would just be a fancy lookup table. The real trick is forcing the learned embeddings to inherit the geometry of Lab space, so unseen colors can be interpolated. The training objective adds two auxiliary losses on top of the standard flow-matching loss:
- Directional alignment: if moving from color A to color B in Lab space points in a certain direction, the corresponding move in embedding space should point the same way (measured via cosine similarity).
- Interpolation consistency: the embedding of the midpoint between two colors should equal the midpoint of their embeddings, enforcing linearity.
At inference, a query color is mapped by finding its 8 nearest anchors and computing a temperature-scaled softmax weighted sum of their embeddings. The result is injected into T5 before the self-attention layers, so the object token (say, car) can actually attend to the unified color embedding rather than to fragmented digits.
Synthetic data, because photos lie about color
Training this needed clean supervision, and photographic datasets are terrible for that reason. The team constructed NumColor-Data, a synthetic dataset of 500K rendered images with unambiguous color-to-pixel correspondence, eliminating the annotation ambiguity inherent in photographic datasets. They took 100 3D meshes from Objaverse-XL, 34 scenes from BlenderKit, and rendered each object with a uniform Lambertian material under a controlled D65 illuminant in Blender Cycles. The albedo exactly equals the target Lab color, no specular highlights or ambient color casts to confound learning.

The results that make this worth caring about
On GenColorBench with 9.8K numerical color prompts spanning 400+ colors, FLUX with NumColor jumps from 13.82% to 55.71% on the coarse ISCC-L1 test, from 7.74% to 48.02% on the fine ISCC-L3 test, and from 5.86% to 51.96% on CSS3/X11 colors. Color harmony scores also improve by 10 to 30 times.
But the more surprising result is zero-shot transfer. Although trained solely on FLUX, NumColor transfers zero-shot to SD3, SD3.5, PixArt-α, and PixArt-Σ without model-specific adaptation. This works because all these models share the T5-XXL text encoder, and NumColor operates on T5 embeddings.
| Model | Baseline ISCC-L1 | + NumColor | Baseline CSS3/X11 | + NumColor |
|---|---|---|---|---|
| FLUX | 13.82 | 55.71 | 5.86 | 51.96 |
| SD3 | 11.80 | 49.23 | 4.63 | 47.19 |
| SD3.5 | 14.92 | 51.72 | 5.78 | 46.87 |
| PixArt-α | 9.45 | 44.93 | 4.21 | 38.51 |
| PixArt-Σ | 10.21 | 48.56 | 4.09 | 43.90 |
Where it still breaks
Two failure modes remain, and both are inherited from the underlying diffusion models rather than NumColor itself:
- Color leakage: the target color bleeds into the background because cross-attention has no explicit spatial grounding.
- Memory color bias: objects with strong learned color priors resist recoloring. Ask for a green sunflower and you often still get yellow petals. The category breakdown confirms this:
Clothing & Accessorieshits 62.1% accuracy on FLUX, butFruits & Vegetablesdrops to 36.2%.
When this actually matters
The paper frames the use case bluntly: hex codes are the standard for communicating color in professional design software such as Adobe Suite, Canvas, and Blender. For brand-driven content generation, product visualization, or any workflow where a designer hands you a hex code from a style guide, current T2I models are essentially unusable. NumColor changes that math.
The inference overhead is negligible, under 2 milliseconds for a typical prompt with 1 to 3 colors, and the added parameters total 28.7M, roughly 58MB in bfloat16. The paper does not link a public code release, so for now the framework is described but not yet distributed. Given the plug-and-play design and the ability to serve multiple architectures from a single trained ColorBook, this is one of the more portable additions to the diffusion toolkit in recent memory.