1#ifndef PALETTE_FADE_HPP
2#define PALETTE_FADE_HPP
20 static void on_enter_mode(
auto& ctx)
23 ctx.template set_config_bool<ConfigKeys::rampSaturates>(
true);
25 ctx.state.paletteIndex = 0;
28 static void loop(
auto& ctx)
31 static constexpr uint32_t lowestTiming = 20000;
32 static constexpr uint32_t highestTiming = 3000;
34 const float wholePaletteLoopTiming =
35 lmpd_map<float>(ctx.get_active_custom_ramp(), 0, 255, lowestTiming, highestTiming);
38 const float adding = wholePaletteLoopTiming /
static_cast<float>(ctx.lamp.frameDurationMs);
39 ctx.state.paletteIndex += 255.0 / adding;
40 ctx.state.paletteIndex = std::fmod(ctx.state.paletteIndex, 255.0);
static constexpr uint32_t from_palette(UIntTy index, const PaletteTy &palette, uint8_t brightness=255)
Return a color from a palette.
Definition: palettes.hpp:504
std::array< uint32_t, 16 > PaletteTy
Palette types.
Definition: palettes.hpp:18
static constexpr PaletteTy PaletteRainbowColors
HSV Rainbow.
Definition: palettes.hpp:360
Basic "default" modes included with the hardware.
Definition: aurora.hpp:12
Define some useful color palettes, and tools to use them.
Parent object for all custom user modes.
Definition: mode_type.hpp:53
Fade between colors of a palette.
Definition: palette_fade_mode.hpp:16
static constexpr bool hasCustomRamp
hint manager to save our custom ramp
Definition: palette_fade_mode.hpp:18
Definition: palette_fade_mode.hpp:52
static constexpr modes::colors::PaletteTy palette
Color palette to display.
Definition: palette_fade_mode.hpp:54
float paletteIndex
actual palette index
Definition: palette_fade_mode.hpp:56
Fade between the colors of the PartyColor palette.
Definition: palette_fade_mode.hpp:50