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
14080
Light path
cm
Closest 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 46
Gose
EBC 68
Belgian Blond Ale
EBC 812
American IPA
EBC 1228
American Amber Ale
EBC 2033
Munich Dunkel
EBC 3355
English Porter
EBC 3959
Irish Stout
EBC 4979
Imperial Stout
EBC 5979

04 · Quick Start

import { ebcToHex, ebcToRgb, ebcToRgbObject, ebcToRgbArray, srmToHex, srmToRgb, srmToRgbObject, srmToRgbArray } from 'beer-color-rgb';
// 1. Hex string
const hex = ebcToHex(10); // #df9800
const sHex = srmToHex(10); // #ba5b00
// 2. Functional CSS string
const css = ebcToRgb(10); // "rgb(223, 152, 0)"
const sCss = srmToRgb(10); // "rgb(186, 91, 0)"
// 3. Raw data object
const obj = ebcToRgbObject(10); // { r: 223, g: 152, b: 0 }
const sObj = srmToRgbObject(10); // { r: 186, g: 91, b: 0 }
// 4. RGB array
const 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 }); // #f8e1a5

05 · Technical

Features

  • A.J. de Lange spectral model
    fitted on 99 real beers, CIE 1931 / D65
  • EBC & SRM
    both units, same accuracy
  • Tailwind plugin
    EBC 1–80 · SRM 1–40, README
  • ESM + CJS
    TypeScript declarations included, tree-shakeable

Changelog

I drink beer, but you canbuy me a ko-fi