-
Something like this: strip.SetPixelColor(0, HtmlColor(c_HtmlNameFuchsia)); where the html color names are defined in https://github.com/Makuna/NeoPixelBus/blob/master/src/internal/colors/HtmlColorNameStrings.cpp I read this page but couldn't see an obvious answer. Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 6 replies
-
No, those string names are stored in PROGMEM. So, they can't be read like a normal char* on most platforms. They are meant for producing a table to compare to incoming html data that has the names in them rather than be used for constants. (see below for more information) There is no table or list of constants color in this library. Names are only standard when applied by a governing group, like Html. So there could be a table with constant names within that context, and even used for that table. But this has never been request. You could create an issue for this request. Normally, you just build a list of the colors you like and use in your sketch. like...
Background: It must "parse" the string and compare it to known strings, and that is really what those constants are for. This is time consuming, and the lookup table uses a non-significant amount of flash space. So, this is really meant for when you are given a html text data packet to convert rather than use like a constant. The exposed API to parse will not take a PROGMEM string so they can't be used. If you had a string with a name in it, you would use it like this using the short/smaller table...
|
Beta Was this translation helpful? Give feedback.
-
ok thanks. I got chatgpt to create a list of constants. Not sure this is the best way to code it, but it works for me. const HtmlColor HTML_Fuchsia = 0xFF00FF;
const HtmlColor HTML_Gainsboro = 0xDCDCDC;
const HtmlColor HTML_GhostWhite = 0xF8F8FF;
const HtmlColor HTML_Gold = 0xFFD700;
const HtmlColor HTML_Goldenrod = 0xDAA520;
const HtmlColor HTML_Gray = 0x808080;
const HtmlColor HTML_Grey = 0x808080;
const HtmlColor HTML_Green = 0x008000;
const HtmlColor HTML_GreenYellow = 0xADFF2F;
// ... etc
strip.SetPixelColor(0, RgbColor(HTML_Fuchsia));
strip.Show(); I don't think I can easily set a brightness level using this method, would you have a suggestion to do this? |
Beta Was this translation helpful? Give feedback.
-
Branch CORE3 is working on an M5Stack AtomS3 (ESP32-S3) without boot loop using: Mind you I only have a single RGB LED (PixelCount = 1). And I can use I wasn't able to get NeoGamma working with the html colors, it says too many overloaded functions: // Declared as global
NeoGamma<NeoGammaTableMethod> colorGamma;
// In setup(void)
RgbColor color = colorGamma.Correct(HTML_Red);
strip.SetPixelColor(0, color);
strip.Show(); |
Beta Was this translation helpful? Give feedback.
-
update, I belive this error is because there's no method for correcting type |
Beta Was this translation helpful? Give feedback.
you should just be able to pass the constant like