Skip to content

Commit

Permalink
Fix alpha representation in HEX
Browse files Browse the repository at this point in the history
  • Loading branch information
sculpt0r committed Dec 11, 2020
1 parent 8fea2d9 commit 1f12a6e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions core/tools/color.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,12 @@
* @returns {String/*} Hexadecimal color code (e.g. `#FF00FF00`) or default value.
*/
getHexWithAlpha: function() {
return this._.isValidColor ?
formatHexString( this._.red, this._.green, this._.blue, this._.alpha ) :
this._.defaultValue;
if ( !this._.isValidColor ) {
return this._.defaultValue;
}

var alpha = Math.round( this._.alpha * CKEDITOR.tools.color.MAX_RGB_CHANNEL_VALUE );
return formatHexString( this._.red, this._.green, this._.blue, alpha ) ;
},

/**
Expand Down

0 comments on commit 1f12a6e

Please sign in to comment.