Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Added user-friendly support for commonly used colors#166

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
patrick9958 wants to merge7 commits intoadafruit:master
base:master
Choose a base branch
Loading
frompatrick9958:master

Conversation

@patrick9958
Copy link

I've assembled a list of 140 preset colors so that instead of typing, for example,theaterChase(strip.Color(20,34,16), delayval), users can typetheaterChase(TEAL, delayval). Both options for typing colors are available to users and the function will work either way. I've also put all 140 colors into thekeywords.txt file and marked them asKEYWORD2 so users know it will be recognized as a valid color by Arduino. I've already written code and tested it on two separate LED ring models.

I have changed theAdafruit_Neopixel.h file only by adding the#include "hexadecimal_colors_to_strings.h" at the top. I have added a newhexadecimal_colors_to_strings.h file in the directory as well. This file defines a list of 140 commonly used colors along with their hex values.

On top of that, I added a new example file calledcolors.ino in which I demonstrate how these colors can be used.

Patrick Neggie added4 commitsMay 29, 2018 13:53
no additional functions were added to the library. the preset colors you can find in hexadecimal_colors_to_strings.h are now usable in the setPixelColor() function. colors are also color-coded in KEYWORD2 for enhanced user experience. example can be found in colors.ino in examples folder
@ladyada
Copy link
Member

great start! can you remove all changes to NeoPixel.cpp and .h? you dont need to include the colors header file there and cpp has some white space changes (which i'd like to not have in this PR!)

deleted all whitespace modifications and .cpp file now matches the one in the original adafruit neopixel library
@patrick9958
Copy link
Author

patrick9958 commentedJun 28, 2018
edited
Loading

First of all, sorry for taking so long to get back to you. Secondly, I removed all changes to the Neopixel.h and .cpp files. However, when you remove the include reference to the hexadecimal_colors_to_strings.h in the .h file, colors.ino does not compile (reflected by the failed build) because TEAL, YELLOW, and MAROON are now not declared. I could put the library include for the hexadecimal_colors_to_strings.h file at the top of the example but that would kind of defeat the purpose of integrating it within the Adafruit Neopixel library. Let me know how you want me to move forward.

@lights0123
Copy link

I'd like to see these constants namespaced, either by prefixing them withNEO_ or doing something like this:

namespace NeoColors {  const uint32_t BLACK = 0x000000  const uint32_t NAVY = 0x000080}

Because otherwise any user sketches with any of these names won't work anymore. I've seen a couple of LCD graphics libraries that have these same constants, and those sketches won't work anymore without modifying either library (or adding hundreds of#undefs). This also allows sketches to just addusing namespace NeoColors; if they aren't using anything that has a conflict to just use the short name.

@patrick9958
Copy link
Author

I have the#include <stdint.h> at the top of the hexadecimal_colors_to_strings.h file because Arduino was not recognizing uint32_t as a type but the example colors.ino file still won't compile because the hexadecimals.h file isn't included anywhere

@ladyada
Copy link
Member

please ping when this compiles and passes travis CI

@abhinuvpitale
Copy link

You need to include "hexadecimal_to_string.h" header

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@patrick9958@ladyada@lights0123@abhinuvpitale

[8]ページ先頭

©2009-2025 Movatter.jp