use String#padStart for Role#hexColor (#2294)

This commit is contained in:
Dim
2018-01-27 01:42:49 -05:00
committed by SpaceEEC
parent 8c288b56a2
commit 10f98d8e57

View File

@@ -95,9 +95,7 @@ class Role extends Base {
* @readonly * @readonly
*/ */
get hexColor() { get hexColor() {
let col = this.color.toString(16); return `#${this.color.toString(16).padStart(6, '0')}`;
while (col.length < 6) col = `0${col}`;
return `#${col}`;
} }
/** /**