wl2rgb

dnois.utils.wl2rgb(wl: float, gamma: float = 0.8, output_format: Literal['floats', 'ints', 'hex'] = 'floats') tuple[float, float, float] | str

Convert wavelength to RGB color. The output color will be limited to purple if the wavelength is less than 380 nm and to red if the wavelength is greater than 780 nm.

Parameters:
  • wl (float) – Wavelength value.

  • gamma (float) – Gamma value.

  • output_format (str) –

    Output format. Choices:

    'floats'

    Return a 3-tuple of floats in the range [0, 1].

    'ints'

    Return a 3-tuple of integers in the range [0, 255].

    'hex'

    Return a hex string in the format '#rrggbb'. It can be used in matplotlib without extra processing.

Returns:

RGB color. See output_format for details.