Skip to content

Commit 2794d94

Browse files
committed
Color.createColor now populates the color objects color and color32 properties with the results of Phaser.Color.getColor and getColor32 respectively.
1 parent f04c16d commit 2794d94

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ Version 2.1.2 - "Whitebridge" - in development
102102
* jsdoc fixes (thanks @danxexe #1209)
103103
* AnimationParser is now using `value` instead of `nodeValue` when parsing atlas XML files, avoiding Chrome deprecation warnings (thanks @valtterip #1189)
104104
* Color.webToColor restored. Converts a CSS rgba color into a native color value.
105+
* Color.createColor now populates the color objects `color` and `color32` properties with the results of `Phaser.Color.getColor` and `getColor32` respectively.
105106

106107

107108

src/utils/Color.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,10 +439,13 @@ Phaser.Color = {
439439
*/
440440
createColor: function (r, g, b, a, h, s, l, v) {
441441

442-
var out = { r: r || 0, g: g || 0, b: b || 0, a: a || 1, h: h || 0, s: s || 0, l: l || 0, v: v || 0, color: 0 };
442+
var out = { r: r || 0, g: g || 0, b: b || 0, a: a || 1, h: h || 0, s: s || 0, l: l || 0, v: v || 0, color: 0, color32: 0 };
443443

444444
out.rgba = 'rgba(' + out.r + ',' + out.g + ',' + out.b + ',' + out.a + ')';
445445

446+
out.color = Phaser.Color.getColor(out.r, out.g, out.b);
447+
out.color32 = Phaser.Color.getColor32(out.a, out.r, out.g, out.b);
448+
446449
return out;
447450

448451
},

0 commit comments

Comments
 (0)