@@ -218,7 +218,7 @@ define(function (require, exports, module) {
218218 _this = this ;
219219 handler = function ( event ) {
220220 var colorObject , newColor , newFormat ;
221- newFormat = $ ( event . currentTarget ) . html ( ) . toLowerCase ( ) ;
221+ newFormat = $ ( event . currentTarget ) . html ( ) . toLowerCase ( ) . replace ( "%" , "p" ) ;
222222 newColor = _this . getColor ( ) ;
223223 colorObject = tinycolor ( newColor ) ;
224224 switch ( newFormat ) {
@@ -228,6 +228,9 @@ define(function (require, exports, module) {
228228 case "rgba" :
229229 newColor = colorObject . toRgbString ( ) ;
230230 break ;
231+ case "prgba" :
232+ newColor = colorObject . toPercentageRgbString ( ) ;
233+ break ;
231234 case "hex" :
232235 newColor = colorObject . toHexString ( ) ;
233236 _this . _hsv . a = 1 ;
@@ -266,10 +269,10 @@ define(function (require, exports, module) {
266269 }
267270 return color ;
268271 } ;
269-
272+
270273 /**
271274 * Normalize the given color string into the format used by tinycolor, by adding a space
272- * after commas and converting RGB colors from percentages to integers .
275+ * after commas.
273276 * @param {string } color The color to be corrected if it looks like an RGB or HSL color.
274277 * @return {string } a normalized color string.
275278 */
@@ -285,7 +288,7 @@ define(function (require, exports, module) {
285288 normalizedColor = normalizedColor . replace ( / \( \s + / , "(" ) ;
286289 normalizedColor = normalizedColor . replace ( / \s + \) / , ")" ) ;
287290 }
288- return this . _convertToNormalRGB ( normalizedColor . toLowerCase ( ) ) ;
291+ return normalizedColor . toLowerCase ( ) ;
289292 } ;
290293
291294 /** Handle changes in text field */
@@ -385,6 +388,9 @@ define(function (require, exports, module) {
385388 case "rgb" :
386389 colorVal = newColor . toRgbString ( ) ;
387390 break ;
391+ case "prgb" :
392+ colorVal = newColor . toPercentageRgbString ( ) ;
393+ break ;
388394 case "hex" :
389395 case "name" :
390396 colorVal = this . _hsv . a < 1 ? newColor . toRgbString ( ) : newColor . toHexString ( ) ;
0 commit comments