|
5 | 5 | * file, You can obtain one at https://mozilla.org/MPL/2.0/. |
6 | 6 | */ |
7 | 7 |
|
| 8 | +use crate::builtin::color_hsv::rgba_to_hsva; |
8 | 9 | use crate::builtin::inner::InnerColor; |
9 | 10 | use crate::builtin::math::ApproxEq; |
10 | | -use crate::builtin::GString; |
11 | | - |
| 11 | +use crate::builtin::meta::impl_godot_as_self; |
| 12 | +use crate::builtin::{ColorHsv, GString}; |
12 | 13 | use godot_ffi as sys; |
13 | | -use sys::{ffi_methods, GodotFfi}; |
14 | | - |
15 | 14 | use std::ops; |
16 | | - |
17 | | -use super::meta::impl_godot_as_self; |
18 | | -use super::{rgba_to_hsva, ColorHsv}; |
| 15 | +use sys::{ffi_methods, GodotFfi}; |
19 | 16 |
|
20 | 17 | /// Color built-in type, in floating-point RGBA format. |
21 | 18 | /// |
22 | 19 | /// Channel values are _typically_ in the range of 0 to 1, but this is not a requirement, and |
23 | 20 | /// values outside this range are explicitly allowed for e.g. High Dynamic Range (HDR). |
24 | 21 | /// |
25 | | -/// To access its [**HSVA**](super::ColorHsv) representation, use [`Color::to_hsv`]. |
| 22 | +/// To access its [**HSVA**](ColorHsv) representation, use [`Color::to_hsv`]. |
26 | 23 | #[repr(C)] |
27 | 24 | #[derive(Copy, Clone, PartialEq, PartialOrd, Debug)] |
28 | 25 | #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] |
@@ -100,8 +97,8 @@ impl Color { |
100 | 97 | /// Constructs a `Color` from a string, which can be either: |
101 | 98 | /// |
102 | 99 | /// - An HTML color code as accepted by [`Color::from_html`]. |
103 | | - /// - The name of a built-in color constant, such as `BLUE` or `lawn-green`. Matching is case |
104 | | - /// insensitive and hyphens can be used interchangeably with underscores. See the [list of |
| 100 | + /// - The name of a built-in color constant, such as `BLUE` or `lawn-green`. Matching is case-insensitive |
| 101 | + /// and hyphens can be used interchangeably with underscores. See the [list of |
105 | 102 | /// color constants][color_constants] in the Godot API documentation, or the visual [cheat |
106 | 103 | /// sheet][cheat_sheet] for the full list. |
107 | 104 | /// |
@@ -365,6 +362,7 @@ impl ApproxEq for Color { |
365 | 362 | } |
366 | 363 | } |
367 | 364 |
|
| 365 | +/// Defines how individual color channels are laid out in memory. |
368 | 366 | #[derive(Copy, Clone, Eq, PartialEq, Debug)] |
369 | 367 | pub enum ColorChannelOrder { |
370 | 368 | /// RGBA channel order. Godot's default. |
@@ -566,7 +564,7 @@ impl std::fmt::Display for Color { |
566 | 564 | /// # Example |
567 | 565 | /// ``` |
568 | 566 | /// use godot::prelude::*; |
569 | | - /// let color = Color::from_rgba(1.0,1.0,1.0,1.0); |
| 567 | + /// let color = Color::from_rgba(1.0, 1.0, 1.0, 1.0); |
570 | 568 | /// assert_eq!(format!("{}", color), "(1, 1, 1, 1)"); |
571 | 569 | /// ``` |
572 | 570 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
|
0 commit comments