added handling of numbers for Pixi.js hex format with tests#98
added handling of numbers for Pixi.js hex format with tests#98weepy wants to merge 2 commits intobgrins:masterfrom
Conversation
|
Interesting, I haven't seen that format before |
tinycolor.js
Outdated
There was a problem hiding this comment.
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`