Skip to content

Commit 504e025

Browse files
authored
Fix incorrect conversion of rgba to hex8 in color picker (#6672)
* Fix incorrect conversion of rgba to hex8 in color picker * Fix parsing of hex8 strings too
1 parent 4c81bad commit 504e025

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

packages/core/src/utils/ColorPicker.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1818,10 +1818,10 @@ export default function ($, undefined?: any) {
18181818
// Returns an 8 character hex
18191819
function rgbaToHex(r, g, b, a) {
18201820
var hex = [
1821-
pad2(convertDecimalToHex(a)),
18221821
pad2(mathRound(r).toString(16)),
18231822
pad2(mathRound(g).toString(16)),
18241823
pad2(mathRound(b).toString(16)),
1824+
pad2(convertDecimalToHex(a)),
18251825
];
18261826

18271827
return hex.join('');
@@ -2406,10 +2406,10 @@ export default function ($, undefined?: any) {
24062406
}
24072407
if ((match = matchers.hex8.exec(color))) {
24082408
return {
2409-
a: convertHexToDecimal(match[1]),
2410-
r: parseIntFromHex(match[2]),
2411-
g: parseIntFromHex(match[3]),
2412-
b: parseIntFromHex(match[4]),
2409+
r: parseIntFromHex(match[1]),
2410+
g: parseIntFromHex(match[2]),
2411+
b: parseIntFromHex(match[3]),
2412+
a: convertHexToDecimal(match[4]),
24132413
format: named ? 'name' : 'hex8',
24142414
};
24152415
}

0 commit comments

Comments
 (0)