/luminator-rs

(Learning Rust) Get the luminance of a hex color code

Primary LanguageRustApache License 2.0Apache-2.0

Luminator

A script that takes RGB hex codes like a0df00 and prints a luminance value for them. Like the Y in YIQ.

luminator-rs

I did this in Python centuries ago, for determining accessibility of contrast on a long-dead theme for my website. This version is rewritten in Rust.

Standards

This uses the luma coefficients from Rec. 601 (CCIR 601), that is:

Y'[601] = 0.299*R' + 0.587*G' + 0.114*B'

I did not know about BT. 709 at the time, and there are no plans to support it.

License

Apache 2.