-
Notifications
You must be signed in to change notification settings - Fork 441
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added handling of numbers for Pixi.js hex format with tests #98
base: master
Are you sure you want to change the base?
Conversation
Interesting, I haven't seen that format before |
@@ -18,15 +18,19 @@ function tinycolor (color, opts) { | |||
color = (color) ? color : ''; | |||
opts = opts || { }; | |||
|
|||
|
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.
Nit: can you remove the whitespace changes in this file?
Does this pixi.js project have some test cases for their hex conversion? Like, how does it handle numbers with > 6 digits? |
There should also be a variation in .toString() for the "number" case that calls .toNumber() |
Pixi uses the numbers internally for the GPU. There's a one-to-one mapping to string hex. e.g |
It looks like there was a |
So |
Not sure about the big one. 0x00ff00 just becomes 0xff00 which is On Tue, 11 Aug 2015 18:00 Brian Grinstead notifications@github.com wrote:
|
I had a negative in front of it :). So, |
I'm not really sure. Maybe ultraviolet?! ;-) On Tue, 11 Aug 2015 22:21 Brian Grinstead notifications@github.com wrote:
|
did u decide on this PR ? On Wed, Aug 12, 2015 at 7:38 AM Jonah Fox jonahfox@gmail.com wrote:
|
I would love to see this merged in. It's very useful when using libraries like pixi.js |
Sorry, for the slow response. This pixi.js library is the only place I've seen this format used so far, so I'm hesitant to add support for it into the main library. Maybe what we need is some kind of extension API where someone could register |
I would find this useful, either built in or as an extension. For now, I have been passing colours through pixi's utility functions for converting between hex and rgb/string. https://github.com/pixijs/pixi.js/blob/master/src/core/utils/index.js#L24-L65 |
This adds support for raw hex format like in Pixi.js, for example '0xaabbcc
is the same color as
#aabbcc`