NumColor: Precise Numeric Color Control in Text-to-Image Generation
Abstract
Text-to-image diffusion models excel at generating images from nat-ural language prompts, yet fail to interpret numerical colors such as hex codes(#FF5733) and RGB values (rgb(255,87,51)). This limitation stems fromsubword tokenization, which fragments color codes into semantically meaning-less tokens that text encoders cannot map to coherent color representations. Wepresent NumColor, that enables precise numerical color control across multi-ple diffusion architectures. NumColor comprises two components: a Color To-ken Aggregator that detects color specifications regardless of tokenization, anda ColorBook containing 6,707 learnable embeddings that map colors to embed-ding space of text encoder in perceptually uniform CIE Lab space. We introducetwo auxiliary losses, directional alignment and interpolation consistency, to en-force geometric correspondence between Lab and embedding spaces, enablingsmooth color interpolation. To train the ColorBook, we construct NumColor-Data, a synthetic dataset of 500K rendered images with unambiguous color-to-pixel correspondence, eliminating the annotation ambiguity inherent in photo-graphic datasets. Although trained solely on FLUX, NumColor transfers zero-shot to SD3, SD3.5, PixArt-α, and PixArt-Σ without model-specific adaptation.NumColor improves numerical color accuracy by 4–9× across five models, whilesimultaneously improving color harmony scores by 10–30× on GenColorBenchbenchmark. The code is available at https://github.com/moatifbutt/numcolor/.