Beer Color RGB
Convert beer color values to RGB with scientific accuracy.
A TypeScript library that maps EBC and SRM beer-color readings to colorimetrically accurate sRGB through the A.J. de Lange spectral model — Beer-Lambert transmission integrated against CIE 1931 / D65, gamma-encoded.
Preview
ebcToHex(15) → "#cc7500"
rgb(204, 117, 0)
EBC 15 · #cc7500
American Pale Ale
02 · Laboratory
Input
EBC
120406080
Light path
cmClosest style
Belgian Blond Ale
Also: American Pale Ale, American Wheat Beer
HEX
#df9800
RGB
223, 152, 0
SRM
5.1
Specimen
EBC 10 · 5 cm
#df9800
rgb(223, 152, 0)
03 · Spectrum
EBC 1 → 80
Berliner Weisse
EBC 4–6
Gose
EBC 6–8
Belgian Blond Ale
EBC 8–12
American IPA
EBC 12–28
American Amber Ale
EBC 20–33
Munich Dunkel
EBC 33–55
English Porter
EBC 39–59
Irish Stout
EBC 49–79
Imperial Stout
EBC 59–79
04 · Quick Start
import { ebcToHex, ebcToRgb, ebcToRgbObject, ebcToRgbArray, srmToHex, srmToRgb, srmToRgbObject, srmToRgbArray } from 'beer-color-rgb'; // 1. Hex stringconst hex = ebcToHex(10); // #df9800const sHex = srmToHex(10); // #ba5b00 // 2. Functional CSS stringconst css = ebcToRgb(10); // "rgb(223, 152, 0)"const sCss = srmToRgb(10); // "rgb(186, 91, 0)" // 3. Raw data objectconst obj = ebcToRgbObject(10); // { r: 223, g: 152, b: 0 }const sObj = srmToRgbObject(10); // { r: 186, g: 91, b: 0 } // 4. RGB arrayconst arr = ebcToRgbArray(10); // [223, 152, 0]const sArr = srmToRgbArray(10); // [186, 91, 0] // 5. Override optical path (lab standard)const lab = ebcToHex(10, { lightPath: 1.27 }); // #f8e1a505 · Technical
Features
- A.J. de Lange spectral modelfitted on 99 real beers, CIE 1931 / D65
- EBC & SRMboth units, same accuracy
- Tailwind pluginEBC 1–80 · SRM 1–40, README
- ESM + CJSTypeScript declarations included, tree-shakeable
References
Changelog
I drink beer, but you canbuy me a ko-fi