Skip to content

Commit

Permalink
added toRgbaString: function
Browse files Browse the repository at this point in the history
  • Loading branch information
CrandellWS authored Nov 4, 2018
1 parent 4924397 commit 4661a69
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tinycolor.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,11 @@ tinycolor.prototype = {
"rgb(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ")" :
"rgba(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ", " + this._roundA + ")";
},
toRgbaString: function() {
return (typeof this._a === "undefined" || this._a == 1) ?
"rgba(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ", 1)" :
"rgba(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ", " + this._roundA + ")";
},
toPercentageRgb: function() {
return { r: mathRound(bound01(this._r, 255) * 100) + "%", g: mathRound(bound01(this._g, 255) * 100) + "%", b: mathRound(bound01(this._b, 255) * 100) + "%", a: this._a };
},
Expand Down

0 comments on commit 4661a69

Please sign in to comment.