You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// Parses from a HTML color code, or `None` on parse error.
45
46
///
47
+
/// Note that unlike most other constructors, this has `ARGB` and not `RGBA` format.
48
+
/// In particular, `from_html("AB123456")` would correspond to `from_rgba_u32(0x123456AB)`.
49
+
///
46
50
/// ```
47
51
/// use gdnative::prelude::Color;
48
52
///
49
-
/// // Each of the following creates the same color RGBA(178, 217, 10, 255).
50
53
/// let c1 = Color::from_html("#9eb2d90a"); // ARGB format with "#".
51
54
/// let c2 = Color::from_html("9eb2d90a"); // ARGB format.
52
55
/// let c3 = Color::from_html("#b2d90a"); // RGB format with "#".
53
56
/// let c4 = Color::from_html("b2d90a"); // RGB format.
54
57
///
55
-
/// let expected = Color::from_rgba_u8(178, 217, 10, 158);
58
+
/// let expected = Color::from_rgba_u8(0xb2, 0xd9, 0x0a, 0x9e);
56
59
/// assert_eq!(c1, Some(expected));
57
60
/// assert_eq!(c2, Some(expected));
58
61
///
59
-
/// let expected = Color::from_rgba_u8(178, 217, 10, 255);
62
+
/// let expected = Color::from_rgba_u8(0xb2, 0xd9, 0x0a, 0xff);
60
63
/// assert_eq!(c3, Some(expected));
61
64
/// assert_eq!(c4, Some(expected));
62
65
/// ```
@@ -112,7 +115,8 @@ impl Color {
112
115
113
116
/// Constructs a color from four integer channels, each in range 0-255.
114
117
///
115
-
/// This corresponds to the [GDScript method `Color8`](https://docs.godotengine.org/en/stable/classes/class_%40gdscript.html#class-gdscript-method-color8)
0 commit comments