Skip to content

Commit 64ddccd

Browse files
committed
Document color conversion
1 parent 954b580 commit 64ddccd

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/color.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
/// A color in the sRGB color space. Each component is in the range `[0, 1]`.
2+
///
3+
/// ## Examples
4+
/// ```
5+
/// # use mundy::Srgba;
6+
/// # let color = Srgba { red: 1., green: 0., blue: 0., alpha: 1. };
7+
/// // Convert each channels to u8
8+
/// let (r, g, b, a) = color.to_u8_array().into();
9+
/// ```
210
#[derive(Debug, Clone, Copy, PartialEq)]
311
pub struct Srgba {
412
pub red: f64,

0 commit comments

Comments
 (0)