Skip to content

Conversation

@DedeHai
Copy link
Collaborator

@DedeHai DedeHai commented Jun 7, 2025

With the new and proper implementation of gamma correction for colors, the palettes imported from http://seaviewsensing.com/pub/cpt-city without any correction by @blazoncek have a slightly different, washed-out look because all three color channels are corrected with the same gamma.
Originally, the palettes were pre-corrected with gammas of 2.6 for red, 2.2 for green and 2.5 for blue.
In order to match the originals after applying the new default gamma of 2.2 the red and blue channels need a slight pre-correction of 2.6/2.2=1.182 for red and 2.5/2.2=1.136 for blue.

The palettes used from FastLed require an inverse-correction of 2.2 to get a close match to the original looks. I also tried with 1.8 and 1.5 to get something "in between" which also looks quite ok but slightly different. Without any inverse-correction, they do not look good, especially party-colors and rainbow colors.
FastLed palettes that use HTML colors (clouds, lava, ocean, forest) I left untouched as I think they do look slightly better than the originals, up for discussion.

Also: changed the default value for gamma correction to 2.2.

Summary by CodeRabbit

  • New Features

    • Added three new color palettes with improved gamma correction for more accurate color representation.
  • Improvements

    • Updated many existing color palettes for better color consistency and accuracy.
    • Adjusted the default gamma correction value for improved color processing.
  • Documentation

    • Expanded explanations regarding gamma correction and palette handling for better user understanding.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 7, 2025

Walkthrough

The changes update color palette data in wled00/palettes.h to apply gamma correction consistent with a new default gamma value of 2.2. Three new gamma-corrected FastLED palettes are introduced and referenced. The global gamma correction value in wled00/wled.h is changed from 2.8 to 2.2.

Changes

File(s) Change Summary
wled00/palettes.h Adjusted RGB values of many palettes for gamma 2.2, expanded comments on gamma handling, added three new gamma-corrected FastLED palettes, and updated the fastledPalettes array to use them.
wled00/wled.h Changed default value of global gammaCorrectVal from 2.8f to 2.2f.
✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
wled00/palettes.h (1)

5-11: Clarify gamma correction rationale in header comment
The updated block accurately describes pre-applied (1.182,1.0,1.136) and inverse (2.2) gammas. Consider explicitly naming which palettes fall under each category for future maintainers.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a87b562 and cc59b10.

📒 Files selected for processing (2)
  • wled00/palettes.h (6 hunks)
  • wled00/wled.h (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (20)
  • GitHub Check: wled_build / Build Environments (usermods)
  • GitHub Check: wled_build / Build Environments (esp32_wrover)
  • GitHub Check: wled_build / Build Environments (lolin_s2_mini)
  • GitHub Check: wled_build / Build Environments (esp32_eth)
  • GitHub Check: wled_build / Build Environments (esp32dev_V4)
  • GitHub Check: wled_build / Build Environments (esp32dev)
  • GitHub Check: wled_build / Build Environments (esp32s3dev_16MB_opi)
  • GitHub Check: wled_build / Build Environments (esp32s3dev_8MB_opi)
  • GitHub Check: wled_build / Build Environments (esp01_1m_full_compat)
  • GitHub Check: wled_build / Build Environments (esp32c3dev)
  • GitHub Check: wled_build / Build Environments (esp32s3_4M_qspi)
  • GitHub Check: wled_build / Build Environments (esp01_1m_full)
  • GitHub Check: wled_build / Build Environments (esp8266_2m_160)
  • GitHub Check: wled_build / Build Environments (nodemcuv2)
  • GitHub Check: wled_build / Build Environments (esp8266_2m)
  • GitHub Check: wled_build / Build Environments (esp8266_2m_compat)
  • GitHub Check: wled_build / Build Environments (nodemcuv2_160)
  • GitHub Check: wled_build / Build Environments (esp01_1m_full_160)
  • GitHub Check: wled_build / Build Environments (nodemcuv2_compat)
  • GitHub Check: wled_build / Test cdata.js
🔇 Additional comments (4)
wled00/wled.h (1)

421-424:

Details

✅ Verification successful

Default gamma correction updated from 2.8f to 2.2f
This change aligns the global gamma with the new palette adjustments. Ensure there are no residual references to the old default (2.8f) elsewhere.

Run:


🏁 Script executed:

rg -n "2\.8f" .

Length of output: 17


No residual ‘2.8f’ references found
I ran rg -n "2\.8f" . across the entire repo and confirmed zero matches. The gamma default update from 2.8f to 2.2f in wled00/wled.h is fully applied with no leftover occurrences.

wled00/palettes.h (3)

15-671: Bulk gamma‐corrected gradient palettes updated
All c3g‐imported gradients have been data‐only adjusted to match the new default gamma. PROGMEM usage and formatting remain correct.


672-694: New FastLED palettes added with inverse gamma correction
The PartyColors_gc22, RainbowColors_gc22, and RainbowStripeColors_gc22 definitions correctly contain 16 entries each. Values appear consistent with an inverse gamma of 2.2.


696-704:

Details

❓ Verification inconclusive

fastledPalettes array updated to reference new palettes
Indices for Party, Rainbow, and Rainbow Bands now point to the _gc22 variants. Verify external code or UI mappings relying on these indices still align.

Run:


🏁 Script executed:

rg -n "fastledPalettes" -n .

Length of output: 274


🏁 Script executed:

#!/bin/bash
# Inspect JSON palette handling around line 982
sed -n '950,1020p' wled00/json.cpp

# Inspect FX function palette assignment around line 251
sed -n '240,310p' wled00/FX_fcn.cpp

Length of output: 5041


Verify updated fastledPalettes indices against UI mappings
Indices for Party (6), Rainbow (11), and Rainbow Bands (12) now point to their _gc22 variants. Confirm that any external code or UI reading palettes by index (6–12) still matches these changes, particularly in:

  • wled00/json.cpp – default branch handling i < 13setPaletteColors(curPalette, *fastledPalettes[i-6])
  • wled00/FX_fcn.cpp – progmem palettes branch pal < 13targetPalette = *fastledPalettes[pal-6]

Copy link
Member

@willmmiles willmmiles left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@blazoncek
Copy link
Contributor

I'm fine with that though I'm also fine with palettes prior to update.

@DedeHai DedeHai merged commit 00eb406 into wled:main Jun 8, 2025
21 checks passed
@DedeHai DedeHai deleted the restore_palette_gamma branch June 8, 2025 11:04
@DedeHai DedeHai mentioned this pull request Jul 29, 2025
1 task
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.

3 participants