Decode one sRGB #RRGGBB swatch into the linear color materials are typed
in.
A hex swatch is display-encoded: its digits are what a monitor is asked to
emit, not the energy a shader integrates. Dividing them by 255 and calling
the result linear is a transcription, not a conversion, and it lands roughly
2.3x too bright at midtones: #808080 reads as linear 0.502 when the
swatch means linear 0.216. That transcription is exactly how one production
ended up covering a single roof in two colors, because instanced slots decode
their palette while a material carrying the same digits did not.
The returned hex is re-encoded from the decoded triple rather than copied
from the argument, so the label a caller stores can never disagree with the
numbers beside it. The round trip is exact for all 256 channel values, and a
mixed-case argument comes back normalized.
Alpha is 1: a six-digit swatch is opaque by definition, and a slot where
opacity is irrelevant states that by overwriting a with null.
Decode one sRGB
#RRGGBBswatch into the linear color materials are typed in.A hex swatch is display-encoded: its digits are what a monitor is asked to emit, not the energy a shader integrates. Dividing them by 255 and calling the result linear is a transcription, not a conversion, and it lands roughly 2.3x too bright at midtones:
#808080reads as linear0.502when the swatch means linear0.216. That transcription is exactly how one production ended up covering a single roof in two colors, because instanced slots decode their palette while a material carrying the same digits did not.The returned
hexis re-encoded from the decoded triple rather than copied from the argument, so the label a caller stores can never disagree with the numbers beside it. The round trip is exact for all 256 channel values, and a mixed-case argument comes back normalized.Alpha is
1: a six-digit swatch is opaque by definition, and a slot where opacity is irrelevant states that by overwritingawithnull.