Expand description
§Material Design Colors for Rust
Easily get color variants based on the Material Design Pallete. All colors
are represented as 0xRRGGBB with the first two bytes not used. To access a
color you may use the const fn
under MatColor
or access the const
arrays that are publicly available. Also, check out MatColor::new
to
create Material Design colors based on MatColorVariant
and MatColorAccent
on demand.
For More information, check out the Official Website.
C50
C100
C200
C300
C400
C500
C600
C700
C800
C900
A100
A200
A400
A700
Red
Pink
Purple
DeepPurple
Indigo
Blue
LightBlue
Cyan
Teal
Green
LightGreen
Lime
Yellow
Amber
Orange
DeepOrange
Brown
Gray
BlueGray
§Examples
You may use the const fn
through MatColor
or access them through a specific color.
use matdesign_color::{MatColor, MatColorRed};
let red1: u32 = MatColor.red().c300();
let brown: u32 = MatColor.brown().c900();
let black: u32 = MatColor.black();
let red2 = MatColorRed.c300();
assert_eq!(red1, red2);
Or you may use MatColor::new
to create colors on the fly:
use matdesign_color::{MatColor, MatColorVariant, MatColorAccent};
let orange: Option<u32> = MatColor::new(MatColorVariant::Orange, MatColorAccent::A200);
assert!(orange.is_some());
let no_brown: Option<u32> = MatColor::new(MatColorVariant::Brown, MatColorAccent::A200);
assert!(no_brown.is_none());
You may also use global constant arrays and index them using an accent.
use matdesign_color::{MAT_COLORS_RED, MatColor, MatColorAccent};
let red: u32 = MAT_COLORS_RED[MatColorAccent::A700 as usize];
assert_eq!(red, MatColor.red().a700());
Structs§
- MatColor
- Main access point to all colors.
- MatColor
Amber - Amber color and its accents
- MatColor
Blue - Blue color and its accents
- MatColor
Blue Gray - Blue Gray color and its accents
- MatColor
Brown - Brown color and its accents
- MatColor
Cyan - Cyan color and its accents
- MatColor
Deep Orange - Deep Orange color and its accents
- MatColor
Deep Purple - Deep Purple color and its accents
- MatColor
Gray - Gray color and its accents
- MatColor
Green - Green color and its accents
- MatColor
Indigo - Indigo color and its accents
- MatColor
Light Blue - Light Blue color and its accents
- MatColor
Light Green - Light Green color and its accents
- MatColor
Lime - Lime color and its accents
- MatColor
Orange - Orange color and its accents
- MatColor
Pink - Pink color and its accents
- MatColor
Purple - Purple color and its accents
- MatColor
Red - Red color and its accents
- MatColor
Teal - Teal color and its accents
- MatColor
Yellow - Yellow color and its accents
Enums§
- MatColor
Accent - All the color accents in the 2014 Material Design Pallete.
- MatColor
Variant - All the main color variants by name in the 2014 Material Design Pallete.
Constants§
- MAT_
COLORS_ AMBER - Amber color accents from lightest to darkest
- MAT_
COLORS_ BLUE - Blue color accents from lightest to darkest
- MAT_
COLORS_ BLUE_ GRAY - Blue Gray color accents from lightest to darkest
- MAT_
COLORS_ BROWN - Brown color accents from lightest to darkest
- MAT_
COLORS_ CYAN - Cyan color accents from lightest to darkest
- MAT_
COLORS_ DEEP_ ORANGE - Deep Orange color accents from lightest to darkest
- MAT_
COLORS_ DEEP_ PURPLE - Deep Purple color accents from lightest to darkest
- MAT_
COLORS_ GRAY - Gray color accents from lightest to darkest
- MAT_
COLORS_ GREEN - Green color accents from lightest to darkest
- MAT_
COLORS_ INDIGO - Indigo color accents from lightest to darkest
- MAT_
COLORS_ LIGHT_ BLUE - Light Blue color accents from lightest to darkest
- MAT_
COLORS_ LIGHT_ GREEN - Light Green color accents from lightest to darkest
- MAT_
COLORS_ LIME - Lime color accents from lightest to darkest
- MAT_
COLORS_ ORANGE - Orange color accents from lightest to darkest
- MAT_
COLORS_ PINK - Pink color accents from lightest to darkest
- MAT_
COLORS_ PURPLE - Purple color accents from lightest to darkest
- MAT_
COLORS_ RED - Red color accents from lightest to darkest
- MAT_
COLORS_ TEAL - Teal color accents from lightest to darkest
- MAT_
COLORS_ YELLOW - Yellow color accents from lightest to darkest