mirror of
https://github.com/material-components/material-components-ios.git
synced 2026-02-20 08:27:32 +08:00
This PR replaces API links containing "/api-docs/" with links to suitable header files in GitHub because the site previously linked to is being taken down and replaced with something that won't handle API docs. Closes https://github.com/material-components/material-components-ios/pull/10045 COPYBARA_INTEGRATE_REVIEW=https://github.com/material-components/material-components-ios/pull/10045 from andrewoverton:replace-mio-api-docs-with-github-links 0d6e56cc11d0c147366a4f6cde829d8b51567ecc PiperOrigin-RevId: 323424362
1.9 KiB
1.9 KiB
Palettes
The Palettes component provides Material colors organized into similar palettes.
Design & API Documentation
Installation
Installation with CocoaPods
To add this component to your Xcode project using CocoaPods, add the following to your Podfile:
pod 'MaterialComponents/Palettes'
Then, run the following command:
pod install
Usage
Importing
Before using Palettes, you'll need to import it:
Swift
import MaterialComponents.MaterialPalettes
Objective-C
#import "MaterialPalettes.h"
Using palettes
Much like UIColor objects, MDCPalette objects are immutable static objects you can use to obtain Material colors. All palettes have a set of tints with lower numbers being lighter colors and higher numbers being darker colors. The 500 tint is the most common representative color for its respective palette. Most palettes (but not all) also have a set of accent colors following a similar naming scheme.
Examples
Swift
view.backgroundColor = MDCPalette.green.tint500
Objective-C
self.view.backgroundColor = MDCPalette.greenPalette.tint500;