Skip to content

Rebase generic palette refactor onto current master - #2363

Merged
zackees merged 1 commit into
masterfrom
rebase-pr-1036-generic-palettes
Apr 21, 2026
Merged

zackees merged 1 commit into
masterfrom
rebase-pr-1036-generic-palettes

Conversation

@zackees

@zackees zackees commented Apr 20, 2026 •

Copy link
Copy Markdown
Member

Summary

  • rebase the generic-palette refactor from generic color palettes #1036 onto current master
  • centralize duplicated palette behavior behind shared internal palette helpers
  • preserve the current public palette API while keeping UpscalePalette(...) entry points intact
  • add targeted coverage for 16/32/256 upscaling, progmem constructors, same-size CHSV to CRGB conversion, and implicit single-color constructors

What This Keeps Intact

  • public CHSVPalette16/32/256 and CRGBPalette16/32/256 types remain in place
  • existing UpscalePalette(...) overloads remain the public path
  • compatibility-sensitive constructor behavior such as copy-initializable single-color palettes is preserved
  • gradient palette loaders for CRGBPalette32/256 remain intact

Verification

  • g++ -std=gnu++17 -I. -Isrc -Itests -Isrc/platforms/stub -DSTUB_PLATFORM -x c++ -fsyntax-only tests/fl/gfx/colorutils_palette.cpp
  • compiled the generated test translation unit after removing unrelated existing Meson/MinGW flag issues (-Werror=division-by-zero, missing PCH, forced AVX512 macros)
  • compiled the generated fl.gfx+.cpp translation unit after removing those same unrelated toolchain flags

Notes

This supersedes #1036 with a fresh implementation on top of current master instead of trying to revive the old branch directly.

Summary by CodeRabbit

  • New Features

    • Added support for constructing palettes directly from PROGMEM sources for improved memory efficiency and additional constructor/assignment paths.
  • Refactor

    • Consolidated palette implementations into a shared infrastructure, reducing duplication.
    • Streamlined and optimized palette upscaling and cross-type conversion behavior for consistent results.
  • Tests

    • Added comprehensive tests for palette construction, PROGMEM loading, upscaling, and color-conversion consistency.

@zackees zackees mentioned this pull request Apr 20, 2026
@coderabbitai

coderabbitai Bot commented Apr 20, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 55fb914e-b5f8-40f5-bf63-376b12e752f0

📥 Commits

Reviewing files that changed from the base of the PR and between 5fbc178 and 9146920.

📒 Files selected for processing (3)
  • src/fl/gfx/colorutils.cpp.hpp
  • src/fl/gfx/colorutils.h
  • tests/fl/gfx/colorutils_palette.cpp
✅ Files skipped from review due to trivial changes (2)
  • src/fl/gfx/colorutils.cpp.hpp
  • tests/fl/gfx/colorutils_palette.cpp

📝 Walkthrough

Walkthrough

Introduces a generic template infrastructure for palettes, centralizes PROGMEM loading and fill logic, and replaces per-palette upscaling loops with two helpers (UpscalePaletteRepeat, UpscalePaletteInterpolated). Palette classes now inherit from templates; public UpscalePalette overload signatures are unchanged. Tests validate upscaling and conversions.

Changes

Cohort / File(s) Summary
Palette Upscaling Helpers
src/fl/gfx/colorutils.cpp.hpp
Added detail::UpscalePaletteRepeat and detail::UpscalePaletteInterpolated; updated UpscalePalette(...) overloads to use these helpers for 16→32, 16→256, and 32→256 conversions for CHSV/CRGB.
Palette Core Types & Utilities
src/fl/gfx/colorutils.h
Replaced duplicated palette implementations with detail::TColorPalette<TColor, Size> and detail::TCRGBPalette<Size> specializations. Centralized copy/conversion, PROGMEM loading (loadProgmemPalette), and fill traits; converted CHSVPalette*/CRGBPalette* to thin wrappers and added progmem/size-conversion constructors/operators.
Palette Unit Tests
tests/fl/gfx/colorutils_palette.cpp
Added tests exercising palette construction, PROGMEM constructors, cross-type copies, and upscaling behavior; validates per-index equality vs ColorFromPalette for 16, 32, and 256 sizes across HSV/RGB palettes.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Poem

🐰 I stitched templates neat and tight,

anchors doubled, gradients bright,
PROGMEM reads and converts done,
palettes sing beneath the sun,
hop—upscaled colors take to flight! 🥕🎨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 9.52% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the pull request's main objective: rebasing a generic palette refactor onto the current master branch.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch rebase-pr-1036-generic-palettes

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

Copy link
Copy Markdown
Contributor

📊 Header Compilation Performance

Total Time: 1135.21ms

Top 5 Slowest Headers

  1. FastLED.h - 862.55ms
  2. fl/fastled.h - 371.27ms
  3. fl/task/executor.h - 280.33ms
  4. crgb.h - 215.09ms
  5. fl/gfx/crgb.h - 213.82ms

Warnings

⚠️ Header FastLED.h exceeds 150ms (862.5ms)
⚠️ Header fl/fastled.h exceeds 150ms (371.3ms)
⚠️ Header fl/task/executor.h exceeds 150ms (280.3ms)
⚠️ Header crgb.h exceeds 150ms (215.1ms)
⚠️ Header fl/gfx/crgb.h exceeds 150ms (213.8ms)
⚠️ Header fl/math/ease.h exceeds 150ms (209.0ms)
⚠️ Header fl/math/fixed_point.h exceeds 150ms (206.7ms)
⚠️ Header fl/task/scheduler.h exceeds 50ms (147.1ms)
⚠️ Header fl/stl/singleton.h exceeds 50ms (137.7ms)
⚠️ Header fl/stl/thread_local.h exceeds 50ms (137.0ms)
⚠️ Header fl/stl/thread.h exceeds 50ms (135.9ms)
⚠️ Header platforms/thread.h exceeds 50ms (135.8ms)
⚠️ Header platforms/stub/thread_stub.h exceeds 50ms (135.8ms)
⚠️ Header platforms/stub/thread_stub_stl.h exceeds 50ms (135.7ms)
⚠️ Header fl/task/promise.h exceeds 50ms (119.8ms)
⚠️ Header fl/ui.h exceeds 50ms (119.7ms)
⚠️ Header fl/stl/json.h exceeds 50ms (75.0ms)
⚠️ Header fl/stl/function.h exceeds 50ms (71.5ms)
⚠️ Header fl/math/fixed_point/s4x12.h exceeds 50ms (61.8ms)
⚠️ Header fl/stl/json/types.h exceeds 50ms (58.1ms)
⚠️ Header platforms.h exceeds 50ms (54.1ms)
⚠️ Header platforms/stub/fastled_stub.h exceeds 50ms (54.1ms)
⚠️ Template instantiation time is high (52.7%)

Full Report
================================================================================
FASTLED COMPILATION PERFORMANCE REPORT
================================================================================
Generated: 2026-04-20 21:33:55
Compiler: clang++-17
File: ci/perf/test_compile.cpp

SUMMARY
--------------------------------------------------------------------------------
Total Compilation Time:    1,987.93 ms
Frontend Time:             17.39 ms (0.9%)
Backend Time:              218.74 ms (11.0%)

COMPILATION PHASES
--------------------------------------------------------------------------------
Source                    11190.03 ms (562.9%)
Templates                   593.56 ms ( 29.9%)

FASTLED HEADERS (Level 1 - Direct Includes)
--------------------------------------------------------------------------------
  1356.5 ms - FastLED.h (SLOW)
   669.6 ms - fl/task/executor.h (SLOW)
   463.5 ms - fl/fastled.h (SLOW)
   357.2 ms - fl/task/scheduler.h (SLOW)
   347.8 ms - fl/stl/singleton.h (SLOW)
   347.1 ms - fl/stl/thread_local.h (SLOW)
   346.0 ms - fl/stl/thread.h (SLOW)
   345.9 ms - platforms/thread.h (SLOW)
   345.9 ms - platforms/stub/thread_stub.h (SLOW)
   345.8 ms - platforms/stub/thread_stub_stl.h (SLOW)
   299.0 ms - fl/task/promise.h (SLOW)
   279.4 ms - crgb.h (SLOW)
   278.2 ms - fl/gfx/crgb.h (SLOW)
   273.3 ms - fl/math/ease.h (SLOW)
   270.9 ms - fl/math/fixed_point.h (SLOW)
   250.4 ms - fl/stl/function.h (SLOW)
   126.6 ms - fl/math/fixed_point/s4x12.h (SLOW)
   118.8 ms - fl/ui.h (SLOW)
   106.1 ms - fl/math/sin32.h (SLOW)
   104.2 ms - fl/stl/vector.h (SLOW)

FASTLED HEADERS (Nested Includes - Up to 10 Levels)
--------------------------------------------------------------------------------
FastLED.h (1356.5ms)
  ├─  669.6 ms - fl/task/executor.h
  │ ├─  357.2 ms - fl/task/scheduler.h
  │ │ ├─  347.8 ms - fl/stl/singleton.h
  │ │ │ └─  347.1 ms - fl/stl/thread_local.h
  │ │ │   └─  346.0 ms - fl/stl/thread.h
  │ │ │     └─  345.9 ms - platforms/thread.h
  │ │ │       └─  345.9 ms - platforms/stub/thread_stub.h
  │ │ │         └─  345.8 ms - platforms/stub/thread_stub_stl.h
  │ │ │           └─  339.6 ms - thread
  │ │ │             ├─  197.9 ms - std_thread.h
  │ │ │             └─  124.9 ms - this_thread_sleep.h
  │ │ └─    8.6 ms - fl/task/task.h
  │ │   └─    3.5 ms - fl/trace.h
  │ │     ├─    2.2 ms - fl/stl/chrono.h
  │ │     └─    1.0 ms - fl/stl/tuple.h
  │ ├─  299.0 ms - fl/task/promise.h
  │ │ ├─  250.4 ms - fl/stl/function.h
  │ │ │ ├─  104.2 ms - fl/stl/vector.h
  │ │ │ │ ├─   68.9 ms - fl/math/math.h
  │ │ │ │ │ └─   63.3 ms - fl/stl/undef.h
  │ │ │ │ │   └─  103.1 ms - stdlib.h
  │ │ │ │ │     ├─   52.4 ms - cstdlib
  │ │ │ │ │     │ └─  103.1 ms - stdlib.h
  │ │ │ │ │     │   ├─   52.4 ms - cstdlib
  │ │ │ │ │     │   ├─   14.0 ms - types.h
  │ │ │ │ │     │   ├─    0.6 ms - floatn.h
  │ │ │ │ │     │   └─    0.5 ms - locale_t.h
  │ │ │ │ │     ├─   14.0 ms - types.h
  │ │ │ │ │     │ ├─   14.0 ms - types.h
  │ │ │ │ │     │ │ ├─   14.0 ms - types.h
  │ │ │ │ │     │ │ ├─    2.9 ms - endian.h
  │ │ │ │ │     │ │ ├─    2.8 ms - pthreadtypes.h
  │ │ │ │ │     │ │ └─    2.5 ms - select.h
  │ │ │ │ │     │ ├─    2.9 ms - endian.h
  │ │ │ │ │     │ │ └─    2.9 ms - endian.h
  │ │ │ │ │     │ ├─    2.8 ms - pthreadtypes.h
  │ │ │ │ │     │ │ └─    2.1 ms - thread-shared-types.h
  │ │ │ │ │     │ └─    2.5 ms - select.h
  │ │ │ │ │     │   └─    0.5 ms - sigset_t.h
  │ │ │ │ │     ├─    0.6 ms - floatn.h
  │ │ │ │ │     └─    0.5 ms - locale_t.h
  │ │ │ │ ├─   18.5 ms - fl/stl/allocator.h
  │ │ │ │ │ └─   12.7 ms - fl/stl/bitset.h
  │ │ │ │ │   └─    8.2 ms - fl/stl/bitset_dynamic.h
  │ │ │ │ │     └─    2.1 ms - fl/stl/unique_ptr.h
  │ │ │ │ ├─    6.0 ms - fl/stl/initializer_list.h
  │ │ │ │ ├─    2.7 ms - fl/stl/basic_vector.h
  │ │ │ │ └─    0.7 ms - fl/stl/functional.h
  │ │ │ ├─   84.2 ms - fl/stl/shared_ptr.h
  │ │ │ │ ├─   70.9 ms - fl/stl/type_traits.h
  │ │ │ │ │ └─   64.5 ms - fl/stl/move.h
  │ │ │ │ ├─    8.2 ms - fl/stl/atomic.h
  │ │ │ │ │ └─    7.1 ms - platforms/atomic.h
  │ │ │ │ │   └─    7.0 ms - platforms/shared/atomic.h
  │ │ │ │ └─    0.7 ms - fl/stl/bit_cast.h
  │ │ │ ├─   46.7 ms - fl/stl/variant.h
  │ │ │ │ └─   44.9 ms - fl/stl/new.h
  │ │ │ │   └─   44.9 ms - platforms/new.h
  │ │ │ │     └─   44.9 ms - platforms/shared/new.h
  │ │ │ │       └─   35.4 ms - new
  │ │ │ │         ├─   17.8 ms - c++config.h
  │ │ │ │         │ └─    6.7 ms - os_defines.h
  │ │ │ │         └─    0.6 ms - version.h
  │ │ │ ├─    5.1 ms - fl/stl/compiler_control.h
  │ │ │ └─    4.7 ms - fl/stl/algorithm.h
  │ │ │   └─    2.0 ms - fl/math/random.h
  │ │ │     └─    0.9 ms - fl/math/random8.h
  │ │ └─   43.5 ms - fl/stl/string.h
  │ │   ├─   12.6 ms - fl/stl/basic_string.h
  │ │   │ ├─    1.0 ms - fl/stl/not_null.h
  │ │   │ ├─    0.9 ms - fl/stl/iterator.h
  │ │   │ └─    0.5 ms - fl/stl/charconv.h
  │ │   ├─    8.6 ms - fl/stl/span.h
  │ │   │ └─    3.3 ms - fl/math/geometry.h
  │ │   ├─    5.6 ms - fl/stl/string_view.h
  │ │   └─    1.5 ms - fl/stl/optional.h
  │ ├─   11.1 ms - platforms/await.h
  │ │ └─   10.7 ms - platforms/coroutine_runtime.h
  │ │   └─    9.1 ms - fl/system/engine_events.h
  │ │     ├─    4.7 ms - fl/math/screenmap.h
  │ │     │ └─    3.5 ms - fl/stl/flat_map.h
  │ │     └─    3.0 ms - fl/math/xymap.h
  │ │       └─    0.8 ms - fl/math/lut.h
  │ └─    0.8 ms - fl/task/promise_result.h
  ├─  463.5 ms - fl/fastled.h
  │ ├─  279.4 ms - crgb.h
  │ │ ├─  278.2 ms - fl/gfx/crgb.h
  │ │ │ └─  273.3 ms - fl/math/ease.h
  │ │ │   └─  270.9 ms - fl/math/fixed_point.h
  │ │ │     ├─  126.6 ms - fl/math/fixed_point/s4x12.h
  │ │ │     │ ├─  106.1 ms - fl/math/sin32.h
  │ │ │     │ │ └─  103.0 ms - fl/math/simd.h
  │ │ │     │ │   └─  102.5 ms - fl/math/simd/types.h
  │ │ │     │ │     └─  102.2 ms - platforms/simd.h
  │ │ │     │ ├─    1.0 ms - fl/math/fixed_point/traits.h
  │ │ │     │ └─    0.7 ms - fl/math/fixed_point/isqrt.h
  │ │ │     ├─   18.3 ms - fl/math/fixed_point/s8x8.h
  │ │ │     ├─   18.2 ms - fl/math/fixed_point/s8x24.h
  │ │ │     ├─   18.2 ms - fl/math/fixed_point/s16x16.h
  │ │ │     └─   17.9 ms - fl/math/fixed_point/s24x8.h
  │ │ └─    0.8 ms - chsv.h
  │ │   └─    0.8 ms - fl/gfx/hsv.h
  │ ├─   81.8 ms - platforms.h
  │ │ └─   81.7 ms - platforms/stub/fastled_stub.h
  │ │   ├─   45.7 ms - platforms/stub/fastspi_stub.h
  │ │   │ └─   45.6 ms - platforms/stub/fastspi_stub_generic.h
  │ │   │   ├─   39.5 ms - platforms/shared/active_strip_data/active_strip_data.h
  │ │   │   │ └─   37.4 ms - fl/id_tracker.h
  │ │   │   │   └─   36.6 ms - fl/stl/mutex.h
  │ │   │   │     └─   36.5 ms - platforms/mutex.h
  │ │   │   │       └─   36.4 ms - platforms/stub/mutex_stub.h
  │ │   │   └─    5.8 ms - platforms/shared/active_strip_tracker/active_strip_tracker.h
  │ │   └─   36.0 ms - platforms/stub/clockless_stub.h
  │ │     └─   36.0 ms - platforms/stub/clockless_channel_stub.h
  │ │       ├─   12.9 ms - fl/system/log.h
  │ │       │ └─   12.4 ms - fl/stl/strstream.h
  │ │       ├─   12.7 ms - fl/channels/data.h
  │ │       │ └─    9.4 ms - fl/channels/config.h
  │ │       │   ├─    2.1 ms - fl/chipsets/chipset_timing_config.h
  │ │       │   │ └─    1.4 ms - fl/chipsets/led_timing.h
  │ │       │   └─    1.7 ms - fl/chipsets/spi.h
  │ │       ├─    2.3 ms - fl/channels/manager.h
  │ │       ├─    1.5 ms - fl/stl/weak_ptr.h
  │ │       └─    1.1 ms - fl/channels/driver.h
  │ ├─   36.2 ms - colorutils.h
  │ │ └─   35.7 ms - fl/gfx/colorutils.h
  │ │   ├─    8.6 ms - fl/gfx/blur.h
  │ │   │ └─    4.6 ms - fl/gfx/canvas.h
  │ │   │   └─    2.8 ms - fl/math/alpha.h
  │ │   └─    3.1 ms - fl/gfx/fill.h
  │ ├─   22.9 ms - pixel_controller.h
  │ │ ├─   16.6 ms - pixel_iterator.h
  │ │ │ └─   16.5 ms - fl/chipsets/encoders/pixel_iterator.h
  │ │ │   ├─    4.9 ms - fl/chipsets/encoders/apa102.h
  │ │ │   │ └─    3.8 ms - fl/chipsets/encoders/encoder_utils.h
  │ │ │   │   └─    3.1 ms - fl/gfx/gamma_lut.h
  │ │ │   ├─    4.3 ms - fl/chipsets/encoders/pixel_iterator_adapters.h
  │ │ │   ├─    1.0 ms - fl/chipsets/encoders/sk9822.h
  │ │ │   └─    0.9 ms - fl/chipsets/encoders/hd108.h
  │ │ └─    2.5 ms - rgbw.h
  │ │   └─    2.3 ms - fl/gfx/rgbw.h
  │ └─   22.2 ms - pixeltypes.h
  │   ├─   18.6 ms - lib8tion.h
  │   │ ├─    9.6 ms - fl/math/math8.h
  │   │ │ ├─    5.1 ms - fl/math/intmap.h
  │   │ │ │ └─    4.0 ms - platforms/intmap.h
  │   │ │ ├─    2.4 ms - fl/math/scale8.h
  │   │ │ │ └─    2.4 ms - platforms/scale8.h
  │   │ │ │   └─    1.0 ms - platforms/shared/scale8.h
  │   │ │ └─    2.0 ms - platforms/math8.h
  │   │ │   └─    1.6 ms - platforms/shared/math8.h
  │   │ ├─    2.0 ms - fl/math/beat.h
  │   │ │ └─    1.0 ms - fl/math/trig8.h
  │   │ │   └─    1.0 ms - platforms/trig8.h
  │   │ │     └─    0.9 ms - platforms/shared/trig8.h
  │   │ └─    0.5 ms - fl/math/qfx.h
  │   └─    3.2 ms - crgb.hpp
  ├─  118.8 ms - fl/ui.h
  │ ├─   74.6 ms - fl/stl/json.h
  │ │ └─   57.7 ms - fl/stl/json/types.h
  │ │   └─    7.8 ms - fl/stl/limits.h
  │ ├─    9.9 ms - fl/ui_impl.h
  │ │ └─    9.3 ms - platforms/ui_defs.h
  │ │   ├─    2.0 ms - platforms/shared/ui/json/audio.h
  │ │   │ └─    1.0 ms - platforms/shared/ui/json/audio_internal.h
  │ │   ├─    1.6 ms - platforms/shared/ui/json/button.h
  │ │   │ └─    0.7 ms - platforms/shared/ui/json/ui_internal.h
  │ │   ├─    0.8 ms - platforms/shared/ui/json/help.h
  │ │   ├─    0.8 ms - platforms/shared/ui/json/number_field.h
  │ │   └─    0.8 ms - platforms/shared/ui/json/description.h
  │ └─    9.2 ms - fl/asset.h
  │   └─    8.1 ms - fl/stl/url.h
  ├─   27.5 ms - chipsets.h
  │ ├─   11.1 ms - fl/chipsets/ucs7604.h
  │ │ └─    8.4 ms - fl/chipsets/encoders/ucs7604.h
  │ ├─    6.6 ms - fl/chipsets/apa102.h
  │ ├─    1.7 ms - fl/chipsets/lpd880x.h
  │ ├─    0.8 ms - fl/chipsets/p9813.h
  │ └─    0.8 ms - fl/chipsets/ws2801.h
  └─   22.7 ms - fl/audio/audio_processor.h
    ├─    5.6 ms - fl/audio/audio_context.h
    │ └─    1.6 ms - fl/audio/fft/fft.h
    ├─    2.0 ms - fl/audio/detector/vibe.h
    └─    1.1 ms - fl/audio/signal_conditioner.h
fl/task/executor.h (669.6ms)
  ├─  357.2 ms - fl/task/scheduler.h
  │ ├─  347.8 ms - fl/stl/singleton.h
  │ │ └─  347.1 ms - fl/stl/thread_local.h
  │ │   └─  346.0 ms - fl/stl/thread.h
  │ │     └─  345.9 ms - platforms/thread.h
  │ │       └─  345.9 ms - platforms/stub/thread_stub.h
  │ │         └─  345.8 ms - platforms/stub/thread_stub_stl.h
  │ │           └─  339.6 ms - thread
  │ │             ├─  197.9 ms - std_thread.h
  │ │             │ ├─   63.5 ms - tuple
  │ │             │ ├─   35.1 ms - iosfwd
  │ │             │ ├─   34.2 ms - refwrap.h
  │ │             │ ├─   13.8 ms - gthr.h
  │ │             │ └─    6.1 ms - unique_ptr.h
  │ │             └─  124.9 ms - this_thread_sleep.h
  │ │               ├─  109.4 ms - chrono.h
  │ │               └─    4.9 ms - cerrno
  │ └─    8.6 ms - fl/task/task.h
  │   └─    3.5 ms - fl/trace.h
  │     ├─    2.2 ms - fl/stl/chrono.h
  │     └─    1.0 ms - fl/stl/tuple.h
  ├─  299.0 ms - fl/task/promise.h
  │ ├─  250.4 ms - fl/stl/function.h
  │ │ ├─  104.2 ms - fl/stl/vector.h
  │ │ │ ├─   68.9 ms - fl/math/math.h
  │ │ │ │ └─   63.3 ms - fl/stl/undef.h
  │ │ │ │   └─  103.1 ms - stdlib.h
  │ │ │ │     ├─   52.4 ms - cstdlib
  │ │ │ │     │ └─  103.1 ms - stdlib.h
  │ │ │ │     │   ├─   52.4 ms - cstdlib
  │ │ │ │     │   │ └─  103.1 ms - stdlib.h
  │ │ │ │     │   ├─   14.0 ms - types.h
  │ │ │ │     │   │ ├─   14.0 ms - types.h
  │ │ │ │     │   │ ├─    2.9 ms - endian.h
  │ │ │ │     │   │ ├─    2.8 ms - pthreadtypes.h
  │ │ │ │     │   │ └─    2.5 ms - select.h
  │ │ │ │     │   ├─    0.6 ms - floatn.h
  │ │ │ │     │   └─    0.5 ms - locale_t.h
  │ │ │ │     ├─   14.0 ms - types.h
  │ │ │ │     │ ├─   14.0 ms - types.h
  │ │ │ │     │ │ ├─   14.0 ms - types.h
  │ │ │ │     │ │ │ ├─   14.0 ms - types.h
  │ │ │ │     │ │ │ ├─    2.9 ms - endian.h
  │ │ │ │     │ │ │ ├─    2.8 ms - pthreadtypes.h
  │ │ │ │     │ │ │ └─    2.5 ms - select.h
  │ │ │ │     │ │ ├─    2.9 ms - endian.h
  │ │ │ │     │ │ │ └─    2.9 ms - endian.h
  │ │ │ │     │ │ ├─    2.8 ms - pthreadtypes.h
  │ │ │ │     │ │ │ └─    2.1 ms - thread-shared-types.h
  │ │ │ │     │ │ └─    2.5 ms - select.h
  │ │ │ │     │ │   └─    0.5 ms - sigset_t.h
  │ │ │ │     │ ├─    2.9 ms - endian.h
  │ │ │ │     │ │ └─    2.9 ms - endian.h
  │ │ │ │     │ │   └─    2.9 ms - endian.h
  │ │ │ │     │ ├─    2.8 ms - pthreadtypes.h
  │ │ │ │     │ │ └─    2.1 ms - thread-shared-types.h
  │ │ │ │     │ └─    2.5 ms - select.h
  │ │ │ │     │   └─    0.5 ms - sigset_t.h
  │ │ │ │     ├─    0.6 ms - floatn.h
  │ │ │ │     └─    0.5 ms - locale_t.h
  │ │ │ ├─   18.5 ms - fl/stl/allocator.h
  │ │ │ │ └─   12.7 ms - fl/stl/bitset.h
  │ │ │ │   └─    8.2 ms - fl/stl/bitset_dynamic.h
  │ │ │ │     └─    2.1 ms - fl/stl/unique_ptr.h
  │ │ │ ├─    6.0 ms - fl/stl/initializer_list.h
  │ │ │ ├─    2.7 ms - fl/stl/basic_vector.h
  │ │ │ └─    0.7 ms - fl/stl/functional.h
  │ │ ├─   84.2 ms - fl/stl/shared_ptr.h
  │ │ │ ├─   70.9 ms - fl/stl/type_traits.h
  │ │ │ │ └─   64.5 ms - fl/stl/move.h
  │ │ │ ├─    8.2 ms - fl/stl/atomic.h
  │ │ │ │ └─    7.1 ms - platforms/atomic.h
  │ │ │ │   └─    7.0 ms - platforms/shared/atomic.h
  │ │ │ └─    0.7 ms - fl/stl/bit_cast.h
  │ │ ├─   46.7 ms - fl/stl/variant.h
  │ │ │ └─   44.9 ms - fl/stl/new.h
  │ │ │   └─   44.9 ms - platforms/new.h
  │ │ │     └─   44.9 ms - platforms/shared/new.h
  │ │ │       └─   35.4 ms - new
  │ │ │         ├─   17.8 ms - c++config.h
  │ │ │         │ └─    6.7 ms - os_defines.h
  │ │ │         │   └─    6.1 ms - features.h
  │ │ │         └─    0.6 ms - version.h
  │ │ ├─    5.1 ms - fl/stl/compiler_control.h
  │ │ └─    4.7 ms - fl/stl/algorithm.h
  │ │   └─    2.0 ms - fl/math/random.h
  │ │     └─    0.9 ms - fl/math/random8.h
  │ └─   43.5 ms - fl/stl/string.h
  │   ├─   12.6 ms - fl/stl/basic_string.h
  │   │ ├─    1.0 ms - fl/stl/not_null.h
  │   │ ├─    0.9 ms - fl/stl/iterator.h
  │   │ └─    0.5 ms - fl/stl/charconv.h
  │   ├─    8.6 ms - fl/stl/span.h
  │   │ └─    3.3 ms - fl/math/geometry.h
  │   ├─    5.6 ms - fl/stl/string_view.h
  │   └─    1.5 ms - fl/stl/optional.h
  ├─   11.1 ms - platforms/await.h
  │ └─   10.7 ms - platforms/coroutine_runtime.h
  │   └─    9.1 ms - fl/system/engine_events.h
  │     ├─    4.7 ms - fl/math/screenmap.h
  │     │ └─    3.5 ms - fl/stl/flat_map.h
  │     └─    3.0 ms - fl/math/xymap.h
  │       └─    0.8 ms - fl/math/lut.h
  └─    0.8 ms - fl/task/promise_result.h
fl/fastled.h (463.5ms)
  ├─  279.4 ms - crgb.h
  │ ├─  278.2 ms - fl/gfx/crgb.h
  │ │ └─  273.3 ms - fl/math/ease.h
  │ │   └─  270.9 ms - fl/math/fixed_point.h
  │ │     ├─  126.6 ms - fl/math/fixed_point/s4x12.h
  │ │     │ ├─  106.1 ms - fl/math/sin32.h
  │ │     │ │ └─  103.0 ms - fl/math/simd.h
  │ │     │ │   └─  102.5 ms - fl/math/simd/types.h
  │ │     │ │     └─  102.2 ms - platforms/simd.h
  │ │     │ │       └─  102.1 ms - platforms/shared/simd_x86.hpp
  │ │     │ ├─    1.0 ms - fl/math/fixed_point/traits.h
  │ │     │ └─    0.7 ms - fl/math/fixed_point/isqrt.h
  │ │     ├─   18.3 ms - fl/math/fixed_point/s8x8.h
  │ │     ├─   18.2 ms - fl/math/fixed_point/s8x24.h
  │ │     ├─   18.2 ms - fl/math/fixed_point/s16x16.h
  │ │     └─   17.9 ms - fl/math/fixed_point/s24x8.h
  │ └─    0.8 ms - chsv.h
  │   └─    0.8 ms - fl/gfx/hsv.h
  ├─   81.8 ms - platforms.h
  │ └─   81.7 ms - platforms/stub/fastled_stub.h
  │   ├─   45.7 ms - platforms/stub/fastspi_stub.h
  │   │ └─   45.6 ms - platforms/stub/fastspi_stub_generic.h
  │   │   ├─   39.5 ms - platforms/shared/active_strip_data/active_strip_data.h
  │   │   │ └─   37.4 ms - fl/id_tracker.h
  │   │   │   └─   36.6 ms - fl/stl/mutex.h
  │   │   │     └─   36.5 ms - platforms/mutex.h
  │   │   │       └─   36.4 ms - platforms/stub/mutex_stub.h
  │   │   │         └─   36.3 ms - platforms/stub/mutex_stub_stl.h
  │   │   └─    5.8 ms - platforms/shared/active_strip_tracker/active_strip_tracker.h
  │   └─   36.0 ms - platforms/stub/clockless_stub.h
  │     └─   36.0 ms - platforms/stub/clockless_channel_stub.h
  │       ├─   12.9 ms - fl/system/log.h
  │       │ └─   12.4 ms - fl/stl/strstream.h
  │       ├─   12.7 ms - fl/channels/data.h
  │       │ └─    9.4 ms - fl/channels/config.h
  │       │   ├─    2.1 ms - fl/chipsets/chipset_timing_config.h
  │       │   │ └─    1.4 ms - fl/chipsets/led_timing.h
  │       │   └─    1.7 ms - fl/chipsets/spi.h
  │       ├─    2.3 ms - fl/channels/manager.h
  │       ├─    1.5 ms - fl/stl/weak_ptr.h
  │       └─    1.1 ms - fl/channels/driver.h
  ├─   36.2 ms - colorutils.h
  │ └─   35.7 ms - fl/gfx/colorutils.h
  │   ├─    8.6 ms - fl/gfx/blur.h
  │   │ └─    4.6 ms - fl/gfx/canvas.h
  │   │   └─    2.8 ms - fl/math/alpha.h
  │   └─    3.1 ms - fl/gfx/fill.h
  ├─   22.9 ms - pixel_controller.h
  │ ├─   16.6 ms - pixel_iterator.h
  │ │ └─   16.5 ms - fl/chipsets/encoders/pixel_iterator.h
  │ │   ├─    4.9 ms - fl/chipsets/encoders/apa102.h
  │ │   │ └─    3.8 ms - fl/chipsets/encoders/encoder_utils.h
  │ │   │   └─    3.1 ms - fl/gfx/gamma_lut.h
  │ │   ├─    4.3 ms - fl/chipsets/encoders/pixel_iterator_adapters.h
  │ │   ├─    1.0 ms - fl/chipsets/encoders/sk9822.h
  │ │   └─    0.9 ms - fl/chipsets/encoders/hd108.h
  │ └─    2.5 ms - rgbw.h
  │   └─    2.3 ms - fl/gfx/rgbw.h
  └─   22.2 ms - pixeltypes.h
    ├─   18.6 ms - lib8tion.h
    │ ├─    9.6 ms - fl/math/math8.h
    │ │ ├─    5.1 ms - fl/math/intmap.h
    │ │ │ └─    4.0 ms - platforms/intmap.h
    │ │ ├─    2.4 ms - fl/math/scale8.h
    │ │ │ └─    2.4 ms - platforms/scale8.h
    │ │ │   └─    1.0 ms - platforms/shared/scale8.h
    │ │ └─    2.0 ms - platforms/math8.h
    │ │   └─    1.6 ms - platforms/shared/math8.h
    │ ├─    2.0 ms - fl/math/beat.h
    │ │ └─    1.0 ms - fl/math/trig8.h
    │ │   └─    1.0 ms - platforms/trig8.h
    │ │     └─    0.9 ms - platforms/shared/trig8.h
    │ └─    0.5 ms - fl/math/qfx.h
    └─    3.2 ms - crgb.hpp
fl/ui.h (118.8ms)
  ├─   74.6 ms - fl/stl/json.h
  │ └─   57.7 ms - fl/stl/json/types.h
  │   └─    7.8 ms - fl/stl/limits.h
  ├─    9.9 ms - fl/ui_impl.h
  │ └─    9.3 ms - platforms/ui_defs.h
  │   ├─    2.0 ms - platforms/shared/ui/json/audio.h
  │   │ └─    1.0 ms - platforms/shared/ui/json/audio_internal.h
  │   ├─    1.6 ms - platforms/shared/ui/json/button.h
  │   │ └─    0.7 ms - platforms/shared/ui/json/ui_internal.h
  │   ├─    0.8 ms - platforms/shared/ui/json/help.h
  │   ├─    0.8 ms - platforms/shared/ui/json/number_field.h
  │   └─    0.8 ms - platforms/shared/ui/json/description.h
  └─    9.2 ms - fl/asset.h
    └─    8.1 ms - fl/stl/url.h
chipsets.h (27.5ms)
  ├─   11.1 ms - fl/chipsets/ucs7604.h
  │ └─    8.4 ms - fl/chipsets/encoders/ucs7604.h
  ├─    6.6 ms - fl/chipsets/apa102.h
  ├─    1.7 ms - fl/chipsets/lpd880x.h
  ├─    0.8 ms - fl/chipsets/p9813.h
  └─    0.8 ms - fl/chipsets/ws2801.h

TOP 20 SLOWEST OPERATIONS
--------------------------------------------------------------------------------
  1.  1356.5 ms - Source: FastLED.h
  2.  1356.5 ms - Total Source: 
  3.   669.6 ms - Source: fl/task/executor.h
  4.   627.2 ms - Total ParseClass: 
  5.   463.5 ms - Source: fl/fastled.h
  6.   357.2 ms - Source: fl/task/scheduler.h
  7.   347.8 ms - Source: fl/stl/singleton.h
  8.   347.1 ms - Source: fl/stl/thread_local.h
  9.   346.0 ms - Source: fl/stl/thread.h
 10.   345.9 ms - Source: platforms/thread.h
 11.   345.9 ms - Source: platforms/stub/thread_stub.h
 12.   345.8 ms - Source: platforms/stub/thread_stub_stl.h
 13.   339.6 ms - Source: thread
 14.   299.0 ms - Source: fl/task/promise.h
 15.   279.4 ms - Source: crgb.h
 16.   278.2 ms - Source: fl/gfx/crgb.h
 17.   273.3 ms - Source: fl/math/ease.h
 18.   270.9 ms - Source: fl/math/fixed_point.h
 19.   250.4 ms - Source: fl/stl/function.h
 20.   214.5 ms - Total InstantiateFunction: 

PERFORMANCE FLAGS
--------------------------------------------------------------------------------
⚠️  SLOW HEADERS (>50.0ms):
    - FastLED.h (1356.5ms)
    - fl/task/executor.h (669.6ms)
    - fl/fastled.h (463.5ms)
    - fl/task/scheduler.h (357.2ms)
    - fl/stl/singleton.h (347.8ms)
    - fl/stl/thread_local.h (347.1ms)
    - fl/stl/thread.h (346.0ms)
    - platforms/thread.h (345.9ms)
    - platforms/stub/thread_stub.h (345.9ms)
    - platforms/stub/thread_stub_stl.h (345.8ms)

⚠️  Template instantiation time is high (29.9% of total)
✓  Lexing time is acceptable (<10% of total)

RECOMMENDATIONS
--------------------------------------------------------------------------------
1. Consider optimizing FastLED.h (1356.5ms)
2. Consider optimizing fl/task/executor.h (669.6ms)
3. Consider optimizing fl/fastled.h (463.5ms)

================================================================================

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/fl/gfx/colorutils.h`:
- Around line 531-546: The member-template disambiguator "template" is
incorrectly used without an explicit template argument list in the TCRGBPalette
constructors and assignment operators (symbols: TCRGBPalette, operator=) causing
clang/WASM failures; remove the stray "template" keyword and call the dependent
member directly as Base::copyConverted(...) in each of the four sites (the two
constructors and two operator= overloads) so the calls become
Base::copyConverted(rhs.entries) and Base::copyConverted(rhs) respectively.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b5982033-2845-4fb9-9a60-9d42ff5bb398

📥 Commits

Reviewing files that changed from the base of the PR and between eee316d and 5fbc178.

📒 Files selected for processing (3)
  • src/fl/gfx/colorutils.cpp.hpp
  • src/fl/gfx/colorutils.h
  • tests/fl/gfx/colorutils_palette.cpp

Comment thread src/fl/gfx/colorutils.h Resolved
@zackees
zackees force-pushed the rebase-pr-1036-generic-palettes branch from 5fbc178 to 9146920 Compare April 20, 2026 21:45
@zackees

zackees commented Apr 20, 2026

Copy link
Copy Markdown
Member Author

Addressed the review comment and force-pushed the branch as a single amended commit.

Current head: 9146920c9c

Change made:

  • removed the stray template disambiguator from the four TCRGBPalette copyConverted calls in src/fl/gfx/colorutils.h

Focused verification after the fix:

  • rg now finds no Base::template copyConverted(...) matches in src/fl/gfx/colorutils.h
  • g++ -std=gnu++17 -I. -Isrc -Itests -Isrc/platforms/stub -DSTUB_PLATFORM -x c++ -fsyntax-only tests/fl/gfx/colorutils_palette.cpp
  • the generated palette test TU and fl.gfx+.cpp still compile after stripping the repo's unrelated existing MinGW-only flag issues from the generated commands

@github-actions

Copy link
Copy Markdown
Contributor

📊 Header Compilation Performance

Total Time: 1163.38ms

Top 5 Slowest Headers

  1. FastLED.h - 887.31ms
  2. fl/fastled.h - 381.94ms
  3. fl/task/executor.h - 286.98ms
  4. crgb.h - 219.95ms
  5. fl/gfx/crgb.h - 218.66ms

Warnings

⚠️ Header FastLED.h exceeds 150ms (887.3ms)
⚠️ Header fl/fastled.h exceeds 150ms (381.9ms)
⚠️ Header fl/task/executor.h exceeds 150ms (287.0ms)
⚠️ Header crgb.h exceeds 150ms (219.9ms)
⚠️ Header fl/gfx/crgb.h exceeds 150ms (218.7ms)
⚠️ Header fl/math/ease.h exceeds 150ms (213.7ms)
⚠️ Header fl/math/fixed_point.h exceeds 150ms (211.2ms)
⚠️ Header fl/task/scheduler.h exceeds 150ms (150.8ms)
⚠️ Header fl/stl/singleton.h exceeds 50ms (141.4ms)
⚠️ Header fl/stl/thread_local.h exceeds 50ms (140.7ms)
⚠️ Header fl/stl/thread.h exceeds 50ms (139.6ms)
⚠️ Header platforms/thread.h exceeds 50ms (139.5ms)
⚠️ Header platforms/stub/thread_stub.h exceeds 50ms (139.4ms)
⚠️ Header platforms/stub/thread_stub_stl.h exceeds 50ms (139.4ms)
⚠️ Header fl/ui.h exceeds 50ms (125.8ms)
⚠️ Header fl/task/promise.h exceeds 50ms (122.3ms)
⚠️ Header fl/stl/json.h exceeds 50ms (80.3ms)
⚠️ Header fl/stl/function.h exceeds 50ms (72.8ms)
⚠️ Header fl/math/fixed_point/s4x12.h exceeds 50ms (63.8ms)
⚠️ Header fl/stl/json/types.h exceeds 50ms (59.3ms)
⚠️ Header platforms.h exceeds 50ms (55.1ms)
⚠️ Header platforms/stub/fastled_stub.h exceeds 50ms (55.0ms)
⚠️ Template instantiation time is high (52.7%)

Full Report
================================================================================
FASTLED COMPILATION PERFORMANCE REPORT
================================================================================
Generated: 2026-04-20 21:46:36
Compiler: clang++-17
File: ci/perf/test_compile.cpp

SUMMARY
--------------------------------------------------------------------------------
Total Compilation Time:    1,486.56 ms
Frontend Time:             17.53 ms (1.2%)
Backend Time:              113.82 ms (7.7%)

COMPILATION PHASES
--------------------------------------------------------------------------------
Source                     7881.97 ms (530.2%)
Templates                   610.64 ms ( 41.1%)

FASTLED HEADERS (Level 1 - Direct Includes)
--------------------------------------------------------------------------------
  1062.4 ms - FastLED.h (SLOW)
   420.9 ms - fl/task/executor.h (SLOW)
   416.7 ms - fl/fastled.h (SLOW)
   247.8 ms - crgb.h (SLOW)
   246.5 ms - fl/gfx/crgb.h (SLOW)
   241.4 ms - fl/math/ease.h (SLOW)
   238.9 ms - fl/math/fixed_point.h (SLOW)
   210.9 ms - fl/task/scheduler.h (SLOW)
   201.3 ms - fl/stl/singleton.h (SLOW)
   200.6 ms - fl/stl/thread_local.h (SLOW)
   199.4 ms - fl/stl/thread.h (SLOW)
   199.3 ms - platforms/thread.h (SLOW)
   199.3 ms - platforms/stub/thread_stub.h (SLOW)
   199.2 ms - platforms/stub/thread_stub_stl.h (SLOW)
   195.8 ms - fl/task/promise.h (SLOW)
   145.4 ms - fl/stl/function.h (SLOW)
   122.4 ms - fl/ui.h (SLOW)
    90.9 ms - fl/math/fixed_point/s4x12.h (SLOW)
    76.8 ms - fl/stl/json.h (SLOW)
    70.2 ms - fl/math/sin32.h (SLOW)

FASTLED HEADERS (Nested Includes - Up to 10 Levels)
--------------------------------------------------------------------------------
FastLED.h (1062.4ms)
  ├─  420.9 ms - fl/task/executor.h
  │ ├─  210.9 ms - fl/task/scheduler.h
  │ │ ├─  201.3 ms - fl/stl/singleton.h
  │ │ │ └─  200.6 ms - fl/stl/thread_local.h
  │ │ │   └─  199.4 ms - fl/stl/thread.h
  │ │ │     └─  199.3 ms - platforms/thread.h
  │ │ │       └─  199.3 ms - platforms/stub/thread_stub.h
  │ │ │         └─  199.2 ms - platforms/stub/thread_stub_stl.h
  │ │ │           └─  193.1 ms - thread
  │ │ │             ├─  107.8 ms - std_thread.h
  │ │ │             └─   74.7 ms - this_thread_sleep.h
  │ │ └─    8.8 ms - fl/task/task.h
  │ │   └─    3.6 ms - fl/trace.h
  │ │     ├─    2.3 ms - fl/stl/chrono.h
  │ │     └─    1.0 ms - fl/stl/tuple.h
  │ ├─  195.8 ms - fl/task/promise.h
  │ │ ├─  145.4 ms - fl/stl/function.h
  │ │ │ ├─   68.3 ms - fl/stl/vector.h
  │ │ │ │ ├─   37.5 ms - fl/math/math.h
  │ │ │ │ │ └─   31.8 ms - fl/stl/undef.h
  │ │ │ │ │   └─   60.6 ms - stdlib.h
  │ │ │ │ │     ├─   30.9 ms - cstdlib
  │ │ │ │ │     │ └─   60.6 ms - stdlib.h
  │ │ │ │ │     │   ├─   30.9 ms - cstdlib
  │ │ │ │ │     │   ├─   15.9 ms - types.h
  │ │ │ │ │     │   └─    0.6 ms - floatn.h
  │ │ │ │ │     ├─   15.9 ms - types.h
  │ │ │ │ │     │ ├─   15.9 ms - types.h
  │ │ │ │ │     │ │ ├─   15.9 ms - types.h
  │ │ │ │ │     │ │ ├─    3.2 ms - select.h
  │ │ │ │ │     │ │ ├─    3.2 ms - endian.h
  │ │ │ │ │     │ │ └─    3.0 ms - pthreadtypes.h
  │ │ │ │ │     │ ├─    3.2 ms - select.h
  │ │ │ │ │     │ │ └─    0.8 ms - sigset_t.h
  │ │ │ │ │     │ ├─    3.2 ms - endian.h
  │ │ │ │ │     │ │ └─    3.2 ms - endian.h
  │ │ │ │ │     │ └─    3.0 ms - pthreadtypes.h
  │ │ │ │ │     │   └─    2.2 ms - thread-shared-types.h
  │ │ │ │ │     └─    0.6 ms - floatn.h
  │ │ │ │ ├─   19.0 ms - fl/stl/allocator.h
  │ │ │ │ │ └─   13.0 ms - fl/stl/bitset.h
  │ │ │ │ │   └─    8.3 ms - fl/stl/bitset_dynamic.h
  │ │ │ │ │     └─    2.2 ms - fl/stl/unique_ptr.h
  │ │ │ │ ├─    2.8 ms - fl/stl/basic_vector.h
  │ │ │ │ ├─    0.7 ms - fl/stl/initializer_list.h
  │ │ │ │ └─    0.7 ms - fl/stl/functional.h
  │ │ │ ├─   45.7 ms - fl/stl/shared_ptr.h
  │ │ │ │ ├─   33.1 ms - fl/stl/type_traits.h
  │ │ │ │ │ └─   24.8 ms - fl/stl/move.h
  │ │ │ │ ├─    7.2 ms - fl/stl/atomic.h
  │ │ │ │ │ └─    6.2 ms - platforms/atomic.h
  │ │ │ │ │   └─    6.1 ms - platforms/shared/atomic.h
  │ │ │ │ └─    1.0 ms - fl/stl/bit_cast.h
  │ │ │ ├─   15.1 ms - fl/stl/variant.h
  │ │ │ │ └─   13.2 ms - fl/stl/new.h
  │ │ │ │   └─   13.2 ms - platforms/new.h
  │ │ │ │     └─   13.2 ms - platforms/shared/new.h
  │ │ │ │       └─   12.1 ms - new
  │ │ │ │         ├─    8.6 ms - c++config.h
  │ │ │ │         │ └─    6.5 ms - os_defines.h
  │ │ │ │         └─    0.5 ms - version.h
  │ │ │ ├─    5.8 ms - fl/stl/compiler_control.h
  │ │ │ └─    4.9 ms - fl/stl/algorithm.h
  │ │ │   └─    2.1 ms - fl/math/random.h
  │ │ │     └─    1.0 ms - fl/math/random8.h
  │ │ └─   45.1 ms - fl/stl/string.h
  │ │   ├─   13.2 ms - fl/stl/basic_string.h
  │ │   │ ├─    1.1 ms - fl/stl/not_null.h
  │ │   │ ├─    1.0 ms - fl/stl/iterator.h
  │ │   │ └─    0.5 ms - fl/stl/charconv.h
  │ │   ├─    9.0 ms - fl/stl/span.h
  │ │   │ └─    3.6 ms - fl/math/geometry.h
  │ │   ├─    5.8 ms - fl/stl/string_view.h
  │ │   └─    1.5 ms - fl/stl/optional.h
  │ ├─   11.8 ms - platforms/await.h
  │ │ └─   11.4 ms - platforms/coroutine_runtime.h
  │ │   └─    9.7 ms - fl/system/engine_events.h
  │ │     ├─    5.1 ms - fl/math/screenmap.h
  │ │     │ └─    3.8 ms - fl/stl/flat_map.h
  │ │     └─    3.2 ms - fl/math/xymap.h
  │ │       └─    0.8 ms - fl/math/lut.h
  │ └─    0.8 ms - fl/task/promise_result.h
  ├─  416.7 ms - fl/fastled.h
  │ ├─  247.8 ms - crgb.h
  │ │ ├─  246.5 ms - fl/gfx/crgb.h
  │ │ │ └─  241.4 ms - fl/math/ease.h
  │ │ │   └─  238.9 ms - fl/math/fixed_point.h
  │ │ │     ├─   90.9 ms - fl/math/fixed_point/s4x12.h
  │ │ │     │ ├─   70.2 ms - fl/math/sin32.h
  │ │ │     │ │ └─   66.9 ms - fl/math/simd.h
  │ │ │     │ │   └─   66.3 ms - fl/math/simd/types.h
  │ │ │     │ │     └─   66.1 ms - platforms/simd.h
  │ │ │     │ ├─    1.0 ms - fl/math/fixed_point/traits.h
  │ │ │     │ └─    0.7 ms - fl/math/fixed_point/isqrt.h
  │ │ │     ├─   18.7 ms - fl/math/fixed_point/s8x8.h
  │ │ │     ├─   18.6 ms - fl/math/fixed_point/s8x24.h
  │ │ │     ├─   18.4 ms - fl/math/fixed_point/s16x16.h
  │ │ │     └─   18.3 ms - fl/math/fixed_point/s24x8.h
  │ │ └─    0.9 ms - chsv.h
  │ │   └─    0.8 ms - fl/gfx/hsv.h
  │ ├─   62.7 ms - platforms.h
  │ │ └─   62.6 ms - platforms/stub/fastled_stub.h
  │ │   ├─   36.7 ms - platforms/stub/clockless_stub.h
  │ │   │ └─   36.7 ms - platforms/stub/clockless_channel_stub.h
  │ │   │   ├─   13.1 ms - fl/channels/data.h
  │ │   │   │ └─    9.8 ms - fl/channels/config.h
  │ │   │   │   ├─    2.1 ms - fl/chipsets/chipset_timing_config.h
  │ │   │   │   │ └─    1.4 ms - fl/chipsets/led_timing.h
  │ │   │   │   └─    1.7 ms - fl/chipsets/spi.h
  │ │   │   ├─   13.0 ms - fl/system/log.h
  │ │   │   │ └─   12.6 ms - fl/stl/strstream.h
  │ │   │   ├─    2.3 ms - fl/channels/manager.h
  │ │   │   ├─    1.6 ms - fl/stl/weak_ptr.h
  │ │   │   └─    1.1 ms - fl/channels/driver.h
  │ │   └─   25.8 ms - platforms/stub/fastspi_stub.h
  │ │     └─   25.8 ms - platforms/stub/fastspi_stub_generic.h
  │ │       ├─   19.5 ms - platforms/shared/active_strip_data/active_strip_data.h
  │ │       │ └─   17.3 ms - fl/id_tracker.h
  │ │       │   └─   16.4 ms - fl/stl/mutex.h
  │ │       │     └─   16.3 ms - platforms/mutex.h
  │ │       │       └─   16.2 ms - platforms/stub/mutex_stub.h
  │ │       └─    5.9 ms - platforms/shared/active_strip_tracker/active_strip_tracker.h
  │ ├─   37.6 ms - colorutils.h
  │ │ └─   37.1 ms - fl/gfx/colorutils.h
  │ │   ├─    8.9 ms - fl/gfx/blur.h
  │ │   │ └─    4.7 ms - fl/gfx/canvas.h
  │ │   │   └─    2.9 ms - fl/math/alpha.h
  │ │   └─    3.2 ms - fl/gfx/fill.h
  │ ├─   23.9 ms - pixel_controller.h
  │ │ ├─   17.3 ms - pixel_iterator.h
  │ │ │ └─   17.2 ms - fl/chipsets/encoders/pixel_iterator.h
  │ │ │   ├─    5.1 ms - fl/chipsets/encoders/apa102.h
  │ │ │   │ └─    3.9 ms - fl/chipsets/encoders/encoder_utils.h
  │ │ │   │   └─    3.3 ms - fl/gfx/gamma_lut.h
  │ │ │   ├─    4.5 ms - fl/chipsets/encoders/pixel_iterator_adapters.h
  │ │ │   ├─    1.1 ms - fl/chipsets/encoders/sk9822.h
  │ │ │   └─    0.9 ms - fl/chipsets/encoders/hd108.h
  │ │ └─    2.6 ms - rgbw.h
  │ │   └─    2.4 ms - fl/gfx/rgbw.h
  │ └─   23.1 ms - pixeltypes.h
  │   ├─   19.3 ms - lib8tion.h
  │   │ ├─   10.0 ms - fl/math/math8.h
  │   │ │ ├─    5.3 ms - fl/math/intmap.h
  │   │ │ │ └─    4.2 ms - platforms/intmap.h
  │   │ │ ├─    2.5 ms - fl/math/scale8.h
  │   │ │ │ └─    2.5 ms - platforms/scale8.h
  │   │ │ │   └─    1.0 ms - platforms/shared/scale8.h
  │   │ │ └─    2.1 ms - platforms/math8.h
  │   │ │   └─    1.7 ms - platforms/shared/math8.h
  │   │ ├─    2.1 ms - fl/math/beat.h
  │   │ │ └─    1.1 ms - fl/math/trig8.h
  │   │ │   └─    1.1 ms - platforms/trig8.h
  │   │ │     └─    1.0 ms - platforms/shared/trig8.h
  │   │ └─    0.5 ms - fl/math/qfx.h
  │   └─    3.3 ms - crgb.hpp
  ├─  122.4 ms - fl/ui.h
  │ ├─   76.8 ms - fl/stl/json.h
  │ │ └─   59.3 ms - fl/stl/json/types.h
  │ │   └─    7.9 ms - fl/stl/limits.h
  │ ├─   10.2 ms - fl/ui_impl.h
  │ │ └─    9.6 ms - platforms/ui_defs.h
  │ │   ├─    2.1 ms - platforms/shared/ui/json/audio.h
  │ │   │ └─    1.0 ms - platforms/shared/ui/json/audio_internal.h
  │ │   ├─    1.6 ms - platforms/shared/ui/json/button.h
  │ │   │ └─    0.7 ms - platforms/shared/ui/json/ui_internal.h
  │ │   ├─    0.9 ms - platforms/shared/ui/json/help.h
  │ │   ├─    0.8 ms - platforms/shared/ui/json/number_field.h
  │ │   └─    0.8 ms - platforms/shared/ui/json/description.h
  │ └─    9.6 ms - fl/asset.h
  │   └─    8.5 ms - fl/stl/url.h
  ├─   28.2 ms - chipsets.h
  │ ├─   11.4 ms - fl/chipsets/ucs7604.h
  │ │ └─    8.6 ms - fl/chipsets/encoders/ucs7604.h
  │ ├─    6.7 ms - fl/chipsets/apa102.h
  │ ├─    1.7 ms - fl/chipsets/lpd880x.h
  │ ├─    0.9 ms - fl/chipsets/p9813.h
  │ └─    0.8 ms - fl/chipsets/ws2801.h
  └─   23.1 ms - fl/audio/audio_processor.h
    ├─    5.8 ms - fl/audio/audio_context.h
    │ └─    1.7 ms - fl/audio/fft/fft.h
    ├─    2.1 ms - fl/audio/detector/vibe.h
    └─    1.1 ms - fl/audio/signal_conditioner.h
fl/task/executor.h (420.9ms)
  ├─  210.9 ms - fl/task/scheduler.h
  │ ├─  201.3 ms - fl/stl/singleton.h
  │ │ └─  200.6 ms - fl/stl/thread_local.h
  │ │   └─  199.4 ms - fl/stl/thread.h
  │ │     └─  199.3 ms - platforms/thread.h
  │ │       └─  199.3 ms - platforms/stub/thread_stub.h
  │ │         └─  199.2 ms - platforms/stub/thread_stub_stl.h
  │ │           └─  193.1 ms - thread
  │ │             ├─  107.8 ms - std_thread.h
  │ │             │ ├─   40.6 ms - tuple
  │ │             │ ├─   14.8 ms - iosfwd
  │ │             │ ├─   13.5 ms - refwrap.h
  │ │             │ ├─   12.2 ms - gthr.h
  │ │             │ └─    6.7 ms - unique_ptr.h
  │ │             └─   74.7 ms - this_thread_sleep.h
  │ │               ├─   63.9 ms - chrono.h
  │ │               └─    5.1 ms - cerrno
  │ └─    8.8 ms - fl/task/task.h
  │   └─    3.6 ms - fl/trace.h
  │     ├─    2.3 ms - fl/stl/chrono.h
  │     └─    1.0 ms - fl/stl/tuple.h
  ├─  195.8 ms - fl/task/promise.h
  │ ├─  145.4 ms - fl/stl/function.h
  │ │ ├─   68.3 ms - fl/stl/vector.h
  │ │ │ ├─   37.5 ms - fl/math/math.h
  │ │ │ │ └─   31.8 ms - fl/stl/undef.h
  │ │ │ │   └─   60.6 ms - stdlib.h
  │ │ │ │     ├─   30.9 ms - cstdlib
  │ │ │ │     │ └─   60.6 ms - stdlib.h
  │ │ │ │     │   ├─   30.9 ms - cstdlib
  │ │ │ │     │   │ └─   60.6 ms - stdlib.h
  │ │ │ │     │   ├─   15.9 ms - types.h
  │ │ │ │     │   │ ├─   15.9 ms - types.h
  │ │ │ │     │   │ ├─    3.2 ms - select.h
  │ │ │ │     │   │ ├─    3.2 ms - endian.h
  │ │ │ │     │   │ └─    3.0 ms - pthreadtypes.h
  │ │ │ │     │   └─    0.6 ms - floatn.h
  │ │ │ │     ├─   15.9 ms - types.h
  │ │ │ │     │ ├─   15.9 ms - types.h
  │ │ │ │     │ │ ├─   15.9 ms - types.h
  │ │ │ │     │ │ │ ├─   15.9 ms - types.h
  │ │ │ │     │ │ │ ├─    3.2 ms - select.h
  │ │ │ │     │ │ │ ├─    3.2 ms - endian.h
  │ │ │ │     │ │ │ └─    3.0 ms - pthreadtypes.h
  │ │ │ │     │ │ ├─    3.2 ms - select.h
  │ │ │ │     │ │ │ └─    0.8 ms - sigset_t.h
  │ │ │ │     │ │ ├─    3.2 ms - endian.h
  │ │ │ │     │ │ │ └─    3.2 ms - endian.h
  │ │ │ │     │ │ └─    3.0 ms - pthreadtypes.h
  │ │ │ │     │ │   └─    2.2 ms - thread-shared-types.h
  │ │ │ │     │ ├─    3.2 ms - select.h
  │ │ │ │     │ │ └─    0.8 ms - sigset_t.h
  │ │ │ │     │ ├─    3.2 ms - endian.h
  │ │ │ │     │ │ └─    3.2 ms - endian.h
  │ │ │ │     │ │   └─    3.2 ms - endian.h
  │ │ │ │     │ └─    3.0 ms - pthreadtypes.h
  │ │ │ │     │   └─    2.2 ms - thread-shared-types.h
  │ │ │ │     └─    0.6 ms - floatn.h
  │ │ │ ├─   19.0 ms - fl/stl/allocator.h
  │ │ │ │ └─   13.0 ms - fl/stl/bitset.h
  │ │ │ │   └─    8.3 ms - fl/stl/bitset_dynamic.h
  │ │ │ │     └─    2.2 ms - fl/stl/unique_ptr.h
  │ │ │ ├─    2.8 ms - fl/stl/basic_vector.h
  │ │ │ ├─    0.7 ms - fl/stl/initializer_list.h
  │ │ │ └─    0.7 ms - fl/stl/functional.h
  │ │ ├─   45.7 ms - fl/stl/shared_ptr.h
  │ │ │ ├─   33.1 ms - fl/stl/type_traits.h
  │ │ │ │ └─   24.8 ms - fl/stl/move.h
  │ │ │ ├─    7.2 ms - fl/stl/atomic.h
  │ │ │ │ └─    6.2 ms - platforms/atomic.h
  │ │ │ │   └─    6.1 ms - platforms/shared/atomic.h
  │ │ │ └─    1.0 ms - fl/stl/bit_cast.h
  │ │ ├─   15.1 ms - fl/stl/variant.h
  │ │ │ └─   13.2 ms - fl/stl/new.h
  │ │ │   └─   13.2 ms - platforms/new.h
  │ │ │     └─   13.2 ms - platforms/shared/new.h
  │ │ │       └─   12.1 ms - new
  │ │ │         ├─    8.6 ms - c++config.h
  │ │ │         │ └─    6.5 ms - os_defines.h
  │ │ │         │   └─    6.2 ms - features.h
  │ │ │         └─    0.5 ms - version.h
  │ │ ├─    5.8 ms - fl/stl/compiler_control.h
  │ │ └─    4.9 ms - fl/stl/algorithm.h
  │ │   └─    2.1 ms - fl/math/random.h
  │ │     └─    1.0 ms - fl/math/random8.h
  │ └─   45.1 ms - fl/stl/string.h
  │   ├─   13.2 ms - fl/stl/basic_string.h
  │   │ ├─    1.1 ms - fl/stl/not_null.h
  │   │ ├─    1.0 ms - fl/stl/iterator.h
  │   │ └─    0.5 ms - fl/stl/charconv.h
  │   ├─    9.0 ms - fl/stl/span.h
  │   │ └─    3.6 ms - fl/math/geometry.h
  │   ├─    5.8 ms - fl/stl/string_view.h
  │   └─    1.5 ms - fl/stl/optional.h
  ├─   11.8 ms - platforms/await.h
  │ └─   11.4 ms - platforms/coroutine_runtime.h
  │   └─    9.7 ms - fl/system/engine_events.h
  │     ├─    5.1 ms - fl/math/screenmap.h
  │     │ └─    3.8 ms - fl/stl/flat_map.h
  │     └─    3.2 ms - fl/math/xymap.h
  │       └─    0.8 ms - fl/math/lut.h
  └─    0.8 ms - fl/task/promise_result.h
fl/fastled.h (416.7ms)
  ├─  247.8 ms - crgb.h
  │ ├─  246.5 ms - fl/gfx/crgb.h
  │ │ └─  241.4 ms - fl/math/ease.h
  │ │   └─  238.9 ms - fl/math/fixed_point.h
  │ │     ├─   90.9 ms - fl/math/fixed_point/s4x12.h
  │ │     │ ├─   70.2 ms - fl/math/sin32.h
  │ │     │ │ └─   66.9 ms - fl/math/simd.h
  │ │     │ │   └─   66.3 ms - fl/math/simd/types.h
  │ │     │ │     └─   66.1 ms - platforms/simd.h
  │ │     │ │       └─   66.0 ms - platforms/shared/simd_x86.hpp
  │ │     │ ├─    1.0 ms - fl/math/fixed_point/traits.h
  │ │     │ └─    0.7 ms - fl/math/fixed_point/isqrt.h
  │ │     ├─   18.7 ms - fl/math/fixed_point/s8x8.h
  │ │     ├─   18.6 ms - fl/math/fixed_point/s8x24.h
  │ │     ├─   18.4 ms - fl/math/fixed_point/s16x16.h
  │ │     └─   18.3 ms - fl/math/fixed_point/s24x8.h
  │ └─    0.9 ms - chsv.h
  │   └─    0.8 ms - fl/gfx/hsv.h
  ├─   62.7 ms - platforms.h
  │ └─   62.6 ms - platforms/stub/fastled_stub.h
  │   ├─   36.7 ms - platforms/stub/clockless_stub.h
  │   │ └─   36.7 ms - platforms/stub/clockless_channel_stub.h
  │   │   ├─   13.1 ms - fl/channels/data.h
  │   │   │ └─    9.8 ms - fl/channels/config.h
  │   │   │   ├─    2.1 ms - fl/chipsets/chipset_timing_config.h
  │   │   │   │ └─    1.4 ms - fl/chipsets/led_timing.h
  │   │   │   └─    1.7 ms - fl/chipsets/spi.h
  │   │   ├─   13.0 ms - fl/system/log.h
  │   │   │ └─   12.6 ms - fl/stl/strstream.h
  │   │   ├─    2.3 ms - fl/channels/manager.h
  │   │   ├─    1.6 ms - fl/stl/weak_ptr.h
  │   │   └─    1.1 ms - fl/channels/driver.h
  │   └─   25.8 ms - platforms/stub/fastspi_stub.h
  │     └─   25.8 ms - platforms/stub/fastspi_stub_generic.h
  │       ├─   19.5 ms - platforms/shared/active_strip_data/active_strip_data.h
  │       │ └─   17.3 ms - fl/id_tracker.h
  │       │   └─   16.4 ms - fl/stl/mutex.h
  │       │     └─   16.3 ms - platforms/mutex.h
  │       │       └─   16.2 ms - platforms/stub/mutex_stub.h
  │       │         └─   16.2 ms - platforms/stub/mutex_stub_stl.h
  │       └─    5.9 ms - platforms/shared/active_strip_tracker/active_strip_tracker.h
  ├─   37.6 ms - colorutils.h
  │ └─   37.1 ms - fl/gfx/colorutils.h
  │   ├─    8.9 ms - fl/gfx/blur.h
  │   │ └─    4.7 ms - fl/gfx/canvas.h
  │   │   └─    2.9 ms - fl/math/alpha.h
  │   └─    3.2 ms - fl/gfx/fill.h
  ├─   23.9 ms - pixel_controller.h
  │ ├─   17.3 ms - pixel_iterator.h
  │ │ └─   17.2 ms - fl/chipsets/encoders/pixel_iterator.h
  │ │   ├─    5.1 ms - fl/chipsets/encoders/apa102.h
  │ │   │ └─    3.9 ms - fl/chipsets/encoders/encoder_utils.h
  │ │   │   └─    3.3 ms - fl/gfx/gamma_lut.h
  │ │   ├─    4.5 ms - fl/chipsets/encoders/pixel_iterator_adapters.h
  │ │   ├─    1.1 ms - fl/chipsets/encoders/sk9822.h
  │ │   └─    0.9 ms - fl/chipsets/encoders/hd108.h
  │ └─    2.6 ms - rgbw.h
  │   └─    2.4 ms - fl/gfx/rgbw.h
  └─   23.1 ms - pixeltypes.h
    ├─   19.3 ms - lib8tion.h
    │ ├─   10.0 ms - fl/math/math8.h
    │ │ ├─    5.3 ms - fl/math/intmap.h
    │ │ │ └─    4.2 ms - platforms/intmap.h
    │ │ ├─    2.5 ms - fl/math/scale8.h
    │ │ │ └─    2.5 ms - platforms/scale8.h
    │ │ │   └─    1.0 ms - platforms/shared/scale8.h
    │ │ └─    2.1 ms - platforms/math8.h
    │ │   └─    1.7 ms - platforms/shared/math8.h
    │ ├─    2.1 ms - fl/math/beat.h
    │ │ └─    1.1 ms - fl/math/trig8.h
    │ │   └─    1.1 ms - platforms/trig8.h
    │ │     └─    1.0 ms - platforms/shared/trig8.h
    │ └─    0.5 ms - fl/math/qfx.h
    └─    3.3 ms - crgb.hpp
fl/ui.h (122.4ms)
  ├─   76.8 ms - fl/stl/json.h
  │ └─   59.3 ms - fl/stl/json/types.h
  │   └─    7.9 ms - fl/stl/limits.h
  ├─   10.2 ms - fl/ui_impl.h
  │ └─    9.6 ms - platforms/ui_defs.h
  │   ├─    2.1 ms - platforms/shared/ui/json/audio.h
  │   │ └─    1.0 ms - platforms/shared/ui/json/audio_internal.h
  │   ├─    1.6 ms - platforms/shared/ui/json/button.h
  │   │ └─    0.7 ms - platforms/shared/ui/json/ui_internal.h
  │   ├─    0.9 ms - platforms/shared/ui/json/help.h
  │   ├─    0.8 ms - platforms/shared/ui/json/number_field.h
  │   └─    0.8 ms - platforms/shared/ui/json/description.h
  └─    9.6 ms - fl/asset.h
    └─    8.5 ms - fl/stl/url.h
chipsets.h (28.2ms)
  ├─   11.4 ms - fl/chipsets/ucs7604.h
  │ └─    8.6 ms - fl/chipsets/encoders/ucs7604.h
  ├─    6.7 ms - fl/chipsets/apa102.h
  ├─    1.7 ms - fl/chipsets/lpd880x.h
  ├─    0.9 ms - fl/chipsets/p9813.h
  └─    0.8 ms - fl/chipsets/ws2801.h

TOP 20 SLOWEST OPERATIONS
--------------------------------------------------------------------------------
  1.  1062.4 ms - Source: FastLED.h
  2.  1062.4 ms - Total Source: 
  3.   644.6 ms - Total ParseClass: 
  4.   420.9 ms - Source: fl/task/executor.h
  5.   416.7 ms - Source: fl/fastled.h
  6.   247.8 ms - Source: crgb.h
  7.   246.5 ms - Source: fl/gfx/crgb.h
  8.   241.4 ms - Source: fl/math/ease.h
  9.   238.9 ms - Source: fl/math/fixed_point.h
 10.   219.1 ms - Total InstantiateFunction: 
 11.   210.9 ms - Source: fl/task/scheduler.h
 12.   201.3 ms - Source: fl/stl/singleton.h
 13.   200.6 ms - Source: fl/stl/thread_local.h
 14.   199.4 ms - Source: fl/stl/thread.h
 15.   199.3 ms - Source: platforms/thread.h
 16.   199.3 ms - Source: platforms/stub/thread_stub.h
 17.   199.2 ms - Source: platforms/stub/thread_stub_stl.h
 18.   195.8 ms - Source: fl/task/promise.h
 19.   193.1 ms - Source: thread
 20.   177.4 ms - Total InstantiateClass: 

PERFORMANCE FLAGS
--------------------------------------------------------------------------------
⚠️  SLOW HEADERS (>50.0ms):
    - FastLED.h (1062.4ms)
    - fl/task/executor.h (420.9ms)
    - fl/fastled.h (416.7ms)
    - crgb.h (247.8ms)
    - fl/gfx/crgb.h (246.5ms)
    - fl/math/ease.h (241.4ms)
    - fl/math/fixed_point.h (238.9ms)
    - fl/task/scheduler.h (210.9ms)
    - fl/stl/singleton.h (201.3ms)
    - fl/stl/thread_local.h (200.6ms)

⚠️  Template instantiation time is high (41.1% of total)
✓  Lexing time is acceptable (<10% of total)

RECOMMENDATIONS
--------------------------------------------------------------------------------
1. Consider optimizing FastLED.h (1062.4ms)
2. Consider optimizing fl/task/executor.h (420.9ms)
3. Consider optimizing fl/fastled.h (416.7ms)

================================================================================

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR rebases and modernizes the palette refactor by consolidating duplicated palette behavior behind shared internal helpers while keeping the public CHSVPalette* / CRGBPalette* types and UpscalePalette(...) entry points intact, and adds targeted unit coverage for the refactor’s compatibility-sensitive behaviors.

Changes:

  • Refactors palette class implementations in colorutils.h to use shared internal detail::TColorPalette / detail::TCRGBPalette helpers (including common PROGMEM loading and fill/gradient behavior).
  • Refactors UpscalePalette(...) implementations to use shared internal upscaling helpers (repeat/interpolated) for consistent behavior.
  • Adds focused tests covering 16/32/256 upscaling, PROGMEM constructors, same-size CHSV→CRGB conversion, and single-color copy-initializable construction.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
tests/fl/gfx/colorutils_palette.cpp Adds unit tests validating palette upscaling, PROGMEM loading, CHSV→CRGB conversions, and constructor/assignment compatibility.
src/fl/gfx/colorutils.h Centralizes palette implementation details into shared internal templates/helpers while preserving public palette types and behavior.
src/fl/gfx/colorutils.cpp.hpp Replaces duplicated upscaling loops with shared internal helper templates for repeat/interpolated upscaling.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/fl/gfx/colorutils.h
Comment on lines +434 to +443
TColorPalette(const TColor (&rhs)[Size]) FL_NOEXCEPT { copyBytes(rhs); }

/// Create palette with a gradient from one color to another
/// @param c1 the starting color for the gradient
/// @param c2 the end color for the gradient
CHSVPalette16(const CHSV &c1, const CHSV &c2) FL_NOEXCEPT {
fill_gradient(&(entries[0]), 16, c1, c2);
TColorPalette &operator=(const TColorPalette &rhs) FL_NOEXCEPT {
copyBytes(rhs.entries);
return *this;
}

/// Create palette with three-color gradient
/// @param c1 the starting color for the gradient
/// @param c2 the middle color for the gradient
/// @param c3 the end color for the gradient
CHSVPalette16(const CHSV &c1, const CHSV &c2, const CHSV &c3) FL_NOEXCEPT {
fill_gradient(&(entries[0]), 16, c1, c2, c3);
TColorPalette &operator=(const TColor (&rhs)[Size]) FL_NOEXCEPT {
copyBytes(rhs);
return *this;

Copilot AI Apr 21, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The refactor replaces the previous palette constructors/assignments that accepted const CRGB rhs[16/32/256] (which is effectively const CRGB*) with const TColor (&rhs)[Size]. This is a breaking public-API change: user code that passes a pointer (e.g. CRGB* buf) to construct/assign a palette will no longer compile. To preserve the existing API as stated in the PR description, reintroduce overloads that take const TColor* (and const CHSV* for the CHSV->CRGB conversion paths) and copy/convert Size elements.

Copilot uses AI. Check for mistakes.
Comment thread src/fl/gfx/colorutils.h
for (fl::u16 i = 0; i < (sizeof(entries)); ++i) {
if (*p != *q)
}
for (unsigned int i = 0; i < sizeof(entries); ++i) {

Copilot AI Apr 21, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

operator== iterates with unsigned int i but compares against sizeof(entries) (a size_t). On some toolchains this can trigger signed/unsigned or width mismatch warnings (and potential -Werror failures). Prefer size_t i (or decltype(sizeof(entries))) for the loop counter to match sizeof's type.

Suggested change
for (unsigned int i = 0; i < sizeof(entries); ++i) {
for (decltype(sizeof(entries)) i = 0; i < sizeof(entries); ++i) {

Copilot uses AI. Check for mistakes.
@zackees
zackees merged commit 93c61d4 into master Apr 21, 2026
65 of 90 checks passed
@zackees
zackees deleted the rebase-pr-1036-generic-palettes branch August 21, 2026 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants