Skip to content
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

Is toFloatString() implemented? #232

Open
ghost opened this issue Feb 13, 2022 · 0 comments
Open

Is toFloatString() implemented? #232

ghost opened this issue Feb 13, 2022 · 0 comments

Comments

@ghost
Copy link

ghost commented Feb 13, 2022

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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants