Skip to content

Commit 6bab3c0

Browse files
committed
Merge pull request godotengine#104746 from zaevi/fix_color_html
Fix reversed hex order in `Color::to_html`
2 parents 0861529 + e7f7823 commit 6bab3c0

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

core/math/color.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,8 @@ void _append_hex(float p_val, char32_t *string) {
113113
int v = Math::round(p_val * 255.0f);
114114
v = CLAMP(v, 0, 255);
115115

116-
for (int i = 0; i < 2; i++) {
117-
string[i] = hex_char_table_lower[v & 0xF];
118-
v >>= 4;
119-
}
116+
string[0] = hex_char_table_lower[(v >> 4) & 0xF];
117+
string[1] = hex_char_table_lower[v & 0xF];
120118
}
121119

122120
String Color::to_html(bool p_alpha) const {

0 commit comments

Comments
 (0)