Skip to content

Clarify ColorScheme fromSwatch/fromSeed usage #132584

@Piinks

Description

@Piinks

From flutter/website#9183 (comment)

Currently the API docs does not distinguish which constructor should be used in what context.
The linked comment says:

We don't recommend using fromSwatch (M1/M2 concept) but rather fromSeed (M3+)

but the docs for fromSwatch say

This constructor is used by ThemeData to create its default color scheme.

fromSeed is a bit clearer, but it isn't clear to me as a Flutter developer which I should use and how they differ in the context of M1/2 versus M3

Using the seedColor as a starting point, a set of tonal palettes are constructed. These tonal palettes are based on the Material 3 Color system and provide all the needed colors for a ColorScheme. These colors are designed to work well together and meet contrast requirements for accessibility.

While we're at it, the other constructors should be checked for the same clarity for M1/2/3:

  • dark
  • light
  • highContrastDark
  • highContrastLight

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work listd: api docsIssues with https://api.flutter.dev/f: material designflutter/packages/flutter/material repository.frameworkflutter/packages/flutter repository. See also f: labels.r: fixedIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamtriaged-designTriaged by Design Languages team

Type

No type

Projects

Status

Done (PR merged)

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions