#[repr(C)]pub struct Color {
pub r: f32,
pub g: f32,
pub b: f32,
pub a: f32,
}Fields§
§r: f32§g: f32§b: f32§a: f32Implementations§
Source§impl Color
impl Color
Sourcepub const fn new(r: f32, g: f32, b: f32, a: f32) -> Color
pub const fn new(r: f32, g: f32, b: f32, a: f32) -> Color
Examples found in repository?
More examples
examples/graph.rs (line 7)
3fn main() {
4 let mut graph = Graph::new();
5 graph.graph_desc = GraphDesc {
6 node_color: RED,
7 outer_ring: (Color::new(1., 0.5, 0.8, 1.), 3.5),
8 ..Default::default()
9 };
10 let a = graph.add_node(vec![]);
11 let b = graph.add_node(vec![]);
12 let c = graph.add_node(vec![]);
13
14 let d = graph.add_node(vec![a.idx, b.idx]);
15 let e = graph.add_node(vec![a.idx, c.idx]);
16
17 let _f = graph.add_node(vec![d.idx, e.idx, b.idx]);
18
19 graph.show();
20}Sourcepub fn from_rgba(r: u8, g: u8, b: u8, a: u8) -> Color
pub fn from_rgba(r: u8, g: u8, b: u8, a: u8) -> Color
Build a color from 4 0..255 components Unfortunately it may not be const fn due to https://github.com/rust-lang/rust/issues/57241 When const version is needed “color_u8” macro may be a workaround
pub fn to_vec(&self) -> Vec4
pub fn from_vec(vec: Vec4) -> Color
Trait Implementations§
impl Copy for Color
impl StructuralPartialEq for Color
Auto Trait Implementations§
impl Freeze for Color
impl RefUnwindSafe for Color
impl Send for Color
impl Sync for Color
impl Unpin for Color
impl UnwindSafe for Color
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more