Is toFloatString() implemented?
wafflook opened this issue · 0 comments
wafflook commented
Hi.
In TinyColor v1.4.1 used in this project, toFloatString() is implemented.
I checked the commit log, but it doesn't seem to have been implemented.
Has this method been turned off at some point? It is a very useful method.
I added two methods to match the TinyColor base ;)
toFloatRgb: function() {
return { r: +bound01(this._r, 255).toFixed(2), g: +bound01(this._g, 255).toFixed(2), b: +bound01(this._b, 255).toFixed(2), a: +bound01(this._a, 255).toFixed(2) };
},
toFloatRgbString: function() {
return (this._a == 1) ?
"3f(" + bound01(this._r, 255).toFixed(2) + ", " + bound01(this._g, 255).toFixed(2) + ", " + bound01(this._g, 255).toFixed(2) + ")" :
"4f(" + bound01(this._r, 255).toFixed(2) + ", " + bound01(this._g, 255).toFixed(2) + ", " + bound01(this._g, 255).toFixed(2) + ", " + bound01(this._a, 255).toFixed(2) + ")";
}
thanks :)