Fledex.Color.Functions (fledex v0.7.0)

View Source

A collection of color functions (namely rainbow and gradient)

Summary

Functions

Color correction function: that halfs the intensity of green

Color correction function: that doesn't do anything, i.e. keeps the colors as they are

This function creates a gradient from a start_color to an end_color spread over num_leds

This function creates a sequence of HSV values with the rainbow colors spread over num_leds leds.

This function creates a sequence of RGB values with the rainbow colors

A conversion function that can be configured to have the desired behavior. Several implementations exist for the hsv2rgb conversion with slightly differen results.

Functions

color_correction_g2(arg)

@spec color_correction_g2(Fledex.Color.Types.rgb()) :: Fledex.Color.Types.rgb()

Color correction function: that halfs the intensity of green

color_correction_none(arg)

@spec color_correction_none(Fledex.Color.Types.rgb()) :: Fledex.Color.Types.rgb()

Color correction function: that doesn't do anything, i.e. keeps the colors as they are

create_gradient_rgb(num_leds, start_color, end_color)

@spec create_gradient_rgb(pos_integer(), Fledex.Color.RGB.t(), Fledex.Color.RGB.t()) ::
  [
    Fledex.Color.Types.rgb()
  ]

This function creates a gradient from a start_color to an end_color spread over num_leds

create_rainbow_circular_hsv(num_leds, initial_hue \\ 0, reversed \\ false)

@spec create_rainbow_circular_hsv(pos_integer(), byte(), boolean()) :: [
  Fledex.Color.Types.hsv()
]

This function creates a sequence of HSV values with the rainbow colors spread over num_leds leds.

create_rainbow_circular_rgb(num_leds, opts \\ [])

@spec create_rainbow_circular_rgb(
  pos_integer(),
  keyword()
) :: [Fledex.Color.Types.rgb()]

This function creates a sequence of RGB values with the rainbow colors

The options are:

  • :reversed: The rainbow can go from red (start color) to blue (end color) or the other way around.
  • :initial_hue: The starting color in degree mapped to a byte (e.g. 0..255 corresponds to 0..258). (default: 0)

Additional options that can be specified are those specified in hsv2rgb/2

hsv2rgb(leds, opts \\ [])

@spec hsv2rgb(
  [Fledex.Color.Types.hsv()],
  keyword()
) :: [Fledex.Color.Types.rgb()]

A conversion function that can be configured to have the desired behavior. Several implementations exist for the hsv2rgb conversion with slightly differen results.

The options are: