一個 Dart 套件,實作了 Material Design 3 顏色系統的核心演算法,支援從影像動態產生主題並精確建立色彩音調。它在新的感知色彩空間中運作,以獲得更準確且視覺上一致的結果。此套件支援進階功能,如色彩調和、對比度最佳化以及基於輸入影像的主題自訂,確保跨平台的可存取性與美學品質。
適用情境
從圖像背景生成主題
建立可存取的色彩調色板
自動化UI色彩方案
設計響應式應用主題
實現動態主題
增強視覺一致性
主要特色
用於準確表示的感知色彩空間
基於圖像的顏色提取
帶有亮色/暗色變體的音調產生
無障礙感知的對比度調整
支援 Material Design 3 標準
跨平台相容性
適合對象
UI 設計師實施 Material Design 3
開發動態主題系統
需要自動配色方案生成的應用程式
專注於可及性與視覺和諧的專案
使用 Flutter 開發多平台應用的團隊
使用建議
需要理解 Material Design 3 原則
可能需要額外處理以應對複雜的圖像輸入
最好搭配設計指南使用以獲得最佳效果
僅限顏色系統邏輯——無UI元件
不適用於一般用途的色彩操控
原始 README
以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。
Material Color Utilities
Color is a foundational part of the
Material Design system, alongside typography and
shape. In products, color can communicate brand, reinforce meaning through
semantic roles, and improve usability through
accessible contrast.
Historically, teams hand-picked many colors to cover all UI use cases. In
Material 3,
dynamic color
shifts
Need another platform/language? Check the
existing issues
or open a new one.
Capabilities Overview
The library consists of various components, each having its own folder and
tests, designed to be as self-contained as possible. This enables seamless
integration of subsets into other libraries, like Material Design Components
and Android System UI. Some consumers do not require all components, for
example, MDC doesn’t need quantization, scoring, image extraction.
Components
Purpose
blend
Interpolate, harmonize, animate, and gradate colors in HCT
contrast
Measure contrast, obtain contrastful colors
dislike
Check and fix universally disliked colors
dynamiccolor
Obtain colors that adjust based on UI state (dark theme, style, preferences, contrast requirements, etc.)
hct
A new color space (hue, chrome, tone) based on CAM16 x L*, that accounts for viewing conditions
palettes
Tonal palette — range of colors that varies only in tone Core palette — set of tonal palettes needed to create Material color schemes
quantize
Turn an image into N colors; composed of Celebi, which runs Wu, then WSMeans
scheme
Create static and dynamic color schemes from a single color or a core palette
score
Rank colors for suitability for theming
temperature
Obtain analogous and complementary colors
utilities
Color — convert between color spaces needed to implement HCT/CAM16 Math — functions for ex. ensuring hue is between 0 and 360, clamping, etc. String - convert between strings and integers
We recommend incorporating the Material Theme Builder
Figma plugin
and web tool
into the design workflow. With them, designers can easily experiment with
different dynamic color themes and see how they transform their designs with
just a few clicks.