From bf3e251e2e8bf9de6ca1a6f930e5a35250e938a7 Mon Sep 17 00:00:00 2001 From: SenexCrenshaw <35600301+SenexCrenshaw@users.noreply.github.com> Date: Tue, 2 Mar 2021 09:09:13 -0500 Subject: [PATCH] Migrate ESPColor to Color (#1036) * Migrate ESPColor to Color * Fixed note indentation --- components/light/index.rst | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/components/light/index.rst b/components/light/index.rst index 9358ed4c4..ffb8f2382 100644 --- a/components/light/index.rst +++ b/components/light/index.rst @@ -718,9 +718,13 @@ This effect allows you to access each LED individually in a custom light effect. Available variables in the lambda: - **it** - :apiclass:`AddressableLight ` instance (see API reference for more info). -- **current_color** - :apistruct:`ESPColor ` instance (see API reference for more info). +- **current_color** - :apistruct:`Color ` instance (see API reference for more info). - **initial_run** - A bool which is true on the first execution of the lambda. Useful to reset static variables when restarting a effect. + .. note:: + + ESPColor has been migrated to Color. See :apistruct:`Color ` for more information. + .. code-block:: yaml light: @@ -733,18 +737,18 @@ Available variables in the lambda: // it.size() - Number of LEDs // it[num] - Access the LED at index num. // Set the LED at num to the given r, g, b values - // it[num] = ESPColor(r, g, b); - // Get the color at index num (ESPColor instance) + // it[num] = Color(r, g, b); + // Get the color at index num (Color instance) // it[num].get(); // Example: Simple color wipe for (int i = it.size() - 1; i > 0; i--) { it[i] = it[i - 1].get(); } - it[0] = ESPColor::random_color(); + it[0] = Color::random_color(); // Bonus: use .range() and .all() to set many LEDs without having to write a loop. - it.range(0, 50) = ESPColor::BLACK; + it.range(0, 50) = Color::BLACK; it.all().fade_to_black(10); .. code-block:: yaml @@ -768,7 +772,7 @@ Available variables in the lambda: // again you can use the initial_run variables if (initial_run) { progress = 0; - it.all() = ESPColor::BLACK; + it.all() = Color::BLACK; // optionally do a return so nothing happens until the next update_interval return; }