Skip to main content

pyolfarve

Øl farve ("beer color") renders SRM and EBC beer color values as sRGB colors, following the spectral model described by A. J. de Lange, "Color," in Brewing Materials and Processes, Elsevier, 2016, pp. 199-249.

Given a color value and an optical path length (the width of the glass the beer is viewed through), the sample's spectral transmittance is derived from its absorption coefficient at 430 nm via the Beer-Lambert law, integrated against the CIE 1931 color matching functions of the 2 degree standard colorimetric observer under illuminant D65, and the resulting XYZ tristimulus values are transformed to sRGB.

Installation

pip install olfarve

The package requires Python 3.10 or newer and has no runtime dependencies.

Usage

import olfarve

olfarve.srm_to_srgb(10).to_hex()
olfarve.ebc_to_srgb(20).to_hex()

# The default path length is 5 cm, the width of a typical sample glass
olfarve.srm_to_srgb(10, path_length_cm=1.0).to_hex()

# Results are SRGBColor named tuples of gamma encoded components in [0, 1]
color = olfarve.srm_to_srgb(10)
color.r, color.g, color.b
color.to_rgb8()

# Or start from an absorbance measured at 430 nm
olfarve.absorption_to_srgb(0.7874)

Command line

Installing the package provides an olfarve command. It takes one or more color values and prints them as CSV:

olfarve 1 2 10
1,#fae8b6
2,#f4d180
10,#ba5b00

Pick a scale and a path length:

olfarve --scale ebc --path-length 1.0 8 20 40

Run olfarve --help for the full list of options. The module is also executable via python -m olfarve.

Development

python -m venv .venv && . .venv/bin/activate
pip install -e . --group dev
pytest
ruff check .
mypy

Metadata

Release files for olfarve 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for olfarve 1.0.0
File Size Uploaded Provenance Actions
olfarve-1.0.0.tar.gz 11.3 kB With provenance Details for olfarve-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for olfarve 1.0.0
File Interpreter ABI Platform Actions
olfarve-1.0.0-py3-none-any.whl Python 3 none any Details for olfarve-1.0.0-py3-none-any.whl

Total release size: 22.0 kB

Release files / olfarve-1.0.0.tar.gz

Download URL olfarve-1.0.0.tar.gz
Size 11.3 kB
Tags Source
SHA-256 checksum
How to use checksums
10fe61a481fdc708424c4c9c717672261d21efc55ddd4fa10f1b9de59126a879
BLAKE2b-256 checksum
How to use checksums
5c3e8ad9b2fbbe1e478a6b1e67c7fdba55b3ad2c5af63e7b3c7bb02df74b16fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 4, 2026.

Transparency log

Release files / olfarve-1.0.0-py3-none-any.whl

Download URL olfarve-1.0.0-py3-none-any.whl
Size 10.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d588eb9c513e20fa5ebe887bdd61c10809852fa8478681b067e9ab2c1be1d83e
BLAKE2b-256 checksum
How to use checksums
688ac9da358f845ea8c0c44d24fbfd7c4e8c8b20e3733c86da53f65b9e65e05f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 4, 2026.

Transparency log

Security for olfarve 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for olfarve-1.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 4, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page