-
Notifications
You must be signed in to change notification settings - Fork 599
Conversation
Thanks for contributing some more changes :)
I'm also wondering if it wouldn't be more readable if we actually made it a map of the human-readable names exposed by facebook to the colors. The python clone of this api does this. i.e.
Might end up with more readable code and make it more possible for us to add/adapt/remove colors as time goes on (though I'll admit the names are... strange at best). Just seems like it would be nicer to write/read |
Ah, I haven't seen any constant (non-functional) data exposed via the API so I wasn't sure if that would be against the design you guys have set up. Are those names the official ones exposed by Facebook? I haven't seen them anywhere. |
I switched it to a dictionary using those names; the code should definitely be more readable that way. I also renamed it to |
Seems good to me though I'd change the docs to say that it is an object rather than it returns an object. |
DOCS.md
Outdated
<a name="validThreadColors"></a> | ||
### api.validThreadColors | ||
|
||
Returns a dictionary mapping names of all currently valid thread colors to their hexadecimal values that are accepted by [`api.changeThreadColor`](#changeThreadColor). These colors, listed below, are the ones present in the palette UI used for selecting thread colors on the Messenger client. Due to Facebook backend changes, the thread color can no longer be set to an arbitrary hex value. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can move the note about "Due to Facebook backend changes, the thread color can no longer be set to an arbitrary hex value." to the CHANGELOG.md file and put a link there to this PR? (See the other entries for an example)
I feel like the validity is implied by the fact that we're providing the colors, so just |
Done. |
Seems good, thanks a lot. |
Adds a function to get accepted values for
changeThreadColor
and validation withinchangeThreadColor
to prevent undefined behavior for non-supported colors as per #506.