Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Color type

SGE comes with a featureful Color type. You can create a Color using Color::from_rgb(r: f32, g: f32, b: f32), where rgb range from 0.0 to 1.0, or Color::from_rgb_u8(r: u8, g: u8, b: u8), where rgb range from 0 to 255. Both of these functions have corresponding from_rgba variants that allow you to also specify an opacity/alpha value.

In addition, the Color type has associated constants for every CSS color, and Tailwind color.

Check the reference documentation for the color type for more detail.