Olfarve 1.0.0

dotnet add package Olfarve --version 1.0.0
                    
NuGet\Install-Package Olfarve -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Olfarve" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Olfarve" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Olfarve" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Olfarve --version 1.0.0
                    
#r "nuget: Olfarve, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Olfarve@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Olfarve&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Olfarve&version=1.0.0
                    
Install as a Cake Tool

csolfarve

NuGet version

Ø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

dotnet add package Olfarve

The package targets .NET 8 and .NET 10 and has no runtime dependencies. It is fully cross-platform (Windows, Linux, macOS).

Usage

using Olfarve;
using System.Drawing;

BeerColor.SrmToSrgb(10).ToHex();
BeerColor.EbcToSrgb(20).ToHex();

// The default path length is 5 cm, the width of a typical sample glass
BeerColor.SrmToSrgb(10, pathLengthCm: 1.0).ToHex();

// Results are SRGBColor records of gamma encoded components in [0, 1]
SRGBColor color = BeerColor.SrmToSrgb(10);
var (r, g, b) = color;
color.ToRgb8();
Color drawingColor = color.ToColor();

// Or start from an absorbance measured at 430 nm
BeerColor.AbsorptionToSrgb(0.7874);

Development

Requires the .NET 8 and .NET 10 SDKs (both, to build and test every target framework).

dotnet build
dotnet test
dotnet format --verify-no-changes
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 78 9/5/2026