Open justbittin opened 6 years ago
screenshot example of usage...
Let me know if it suits your needs or if you have any suggestion /feedback... Thanks
That's perfect! Thank you.
I think the only addition needed now would be a
argb(a,r,g,b) input. Again, that's how android takes it.
It just makes it easier when jumping in and out of my backend (java) to keep it consistent.
In Android:
ARGB representation(#AARRGGBB)
AA - Alpha component [0..255] of the color RR - Red component [0..255] of the color GG - Green component [0..255] of the color BB - Blue component [0..255] of the color
So the current constructor for rgba doesn't work without me doing some math to set the alpha (0-1) where droid expects 0-255.
Just another suggestion, and would be great to have :-)
Thank you so much.
the function toHex8ArgbString()
I believe outputs as you desire
this is based on https://developer.android.com/guide/topics/resources/more-resources#Color
assuming your using https://github.com/CrandellWS/TinyColor/blob/toHex8Argb/tinycolor.js
Yes sir, switched to yours immediately.
I'm concerned with the initial input.
I use tinycolor in my hyrid app, and the colors coming from java are all
(Aa, rr, gg, bb) and, they are in range 0-255 even for alpha. Not current 0-1 range.
Am I making sense? :-)
I guess after re reading comment @justbittin
Using my modifications you can add an input option to flag it as #AARRGGBB
//{"hex8Argb": true}
var ArgbColor = '#aaFFFFFF';
var myColor = tinycolor(ArgbColor, {"hex8Argb": true});
myColor.toHex8ArgbString()//"#aaffffff"
We are on different pages, the hex part is perfect. I'm commenting on inputing a rgba - which in android, is argb. And, even in your to8Argbu - yo are outputting a decimal between 0 and 1 for alpha. Android uses 0-255 for alpha as well.
arbg(0,0,0,0)
As far as I know ARGB is done in hex format as shown in the link I gave previously to Android docs.
Can you link to Android documentation on this?
ok give me a bit I will make it happen
might be tomorrow though I am about to sleep
1/2 way there.... gn
Android support is what I am after as well... thanks for pointing this out
ok I think I got it please test it out and let me know if there is any issues
JS file: https://github.com/CrandellWS/TinyColor/blob/toHex8Argb/tinycolor.js
Changes: https://github.com/CrandellWS/TinyColor/commit/c8187a7a6ad1b3fd3f292c558c164eaf1bc53f18
@justbittin good day man
ok I rushed that and the alpha value is not being read correctly
https://github.com/CrandellWS/TinyColor/commit/1a6d1ae
https://codepen.io/anon/pen/MzwKBZ
it is functioning but be warned that the alpha is not 100% accurate...
Ok, I was just about to dl. I'll wait for you to update me :-)
One thing to also remember, when putting output from the 8Argb don't use 0-1 for alpha. Android doesn't use the 0.0 to 1 for alpha, but 0-255 like he links above.
Thanks for all this.
Will this be an official thing? Looks stale and would love a way to do this.
First, this library is amazing.
I would really like to see a way to switch between the current alpha 8 hex (rrggbbaa) to android and other 8 hex format (aarrggbb).
Maybe a constructor option?
Is this a possibility?