def plot_color_temp(inputs: dict[str, Any], sleep_mode: bool) -> plt.Figure:
    """Plot the color temperature over time for different modes."""
    sun = SunLightSettings(**inputs, brightness_mode="default")
    dt_range = date_range(tzinfo=sun.timezone)
    time_range = [time_to_float(dt) for dt in dt_range]
    settings = [sun.brightness_and_color(dt, sleep_mode) for dt in dt_range]
    if sleep_mode and sun.sleep_rgb_or_color_temp == "color_temp":
        colors = [
            color_temperature_to_rgb(setting["color_temp_kelvin"])
            for setting in settings
        ]
    else:
        colors = [setting["rgb_color"] for setting in settings]
    color_temp_values = np.array([(*col, 255) for col in colors]) / 255
    color_temp_values = color_temp_values.reshape(-1, 1, 4)
    sun_position = [setting["sun_position"] for setting in settings]
    fig, ax = plt.subplots(figsize=(10, 6))

    # Display as a horizontal bar
    ax.imshow(
        np.rot90(color_temp_values)[:, ::1],
        aspect="auto",
        extent=[0, 24, -1, 1],
        origin="upper",
    )
    # Plot a curve on top of the imshow
    ax.plot(time_range, sun_position, color="k", label="Sun Position")

    sunrise_time = sun.sun.sunrise(dt.date.today())
    sunset_time = sun.sun.sunset(dt.date.today())
    ax.vlines(
        time_to_float(sunrise_time),
        -1,
        1,
        color="C2",
        label="Sunrise",
        linestyles="dashed",
    )
    ax.vlines(
        time_to_float(sunset_time),
        -1,
        1,
        color="C3",
        label="Sunset",
        linestyles="dashed",
    )

    ax.set_xlim(0, 24)
    ax.set_xticks(np.arange(0, 25, 1))
    yticks = np.arange(-1, 1.1, 0.1)
    ax.set_yticks(yticks, [f"{label*100:.0f}%" for label in yticks])
    ax.set_xlabel("Time (hours)")
    ax.legend()
    ax.set_ylabel("Sun position (%)")
    ax.set_title("RGB Color Intensity over Time")
    ax.grid(visible=False)
    return fig
Plot the color temperature over time for different modes.
webapp/app.py