Crate matdesign_color[][src]

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.

MatColorAmber

Amber color and its accents

MatColorBlue

Blue color and its accents

MatColorBlueGray

Blue Gray color and its accents

MatColorBrown

Brown color and its accents

MatColorCyan

Cyan color and its accents

MatColorDeepOrange

Deep Orange color and its accents

MatColorDeepPurple

Deep Purple color and its accents

MatColorGray

Gray color and its accents

MatColorGreen

Green color and its accents

MatColorIndigo

Indigo color and its accents

MatColorLightBlue

Light Blue color and its accents

MatColorLightGreen

Light Green color and its accents

MatColorLime

Lime color and its accents

MatColorOrange

Orange color and its accents

MatColorPink

Pink color and its accents

MatColorPurple

Purple color and its accents

MatColorRed

Red color and its accents

MatColorTeal

Teal color and its accents

MatColorYellow

Yellow color and its accents

Enums

MatColorAccent

All the color accents in the 2014 Material Design Pallete.

MatColorVariant

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