---
name: flutter-theme-configurator
description: "Generates a complete Flutter ThemeData Dart file from your brand colours and font, with component themes you choose and Material 3 support. Use when a Flutter developer needs a ThemeData file generated from brand colours, a font and chosen component themes. Do not use for refactoring widgets or writing widget tests. Related topics: flutter, dart, design."
---

# Flutter Theme Configurator

Generates a complete Flutter ThemeData Dart file from your brand colours and font, with component themes you choose and Material 3 support.

## When to use

Use this skill when a Flutter developer needs a ThemeData file generated from brand colours, a font and chosen component themes. Do not use it for refactoring widgets or writing widget tests.

## Workflow

1. Ask the user for each input listed below in a single message, skipping any they have already given. Where options are listed, offer them, but accept other answers too.
2. Parse the three hex colours and build a ColorScheme matching the brightness chosen.
3. Check contrast of text on primary and background and fix on-colours that fail.
4. Add each selected component theme with colours, shape and padding consistent with the scheme.
5. Apply the font family via TextTheme and write the file with a usage example.

## Inputs

- **Primary color in hex** (free text, e.g. "#6200EE")
- **Secondary or accent color in hex** (free text, e.g. "#03DAC6")
- **Background color in hex** (free text, e.g. "#FFFFFF")
- **Brightness** (choose one: Light, Dark)
- **Font family** (free text, e.g. "Roboto or Inter or Montserrat")
- **Elements to customize in ThemeData** (choose any: AppBarTheme, ButtonTheme, CardTheme, InputDecorationTheme)
- **Use Material 3 with useMaterial3 true** (choose one: Yes, No)

## Output

A single Dart file exporting one ThemeData with comments per section, followed by a two-line MaterialApp usage example.

## Prompt template

Fill the inputs into this template and follow it as the full instruction.

### Flutter Theme Builder

Generate a custom Flutter theme as a ready-to-use Dart file.

- Primary color in hex: {{Primary color in hex}}
- Secondary or accent color in hex: {{Secondary or accent color in hex}}
- Background color in hex: {{Background color in hex}}
- Brightness: {{Brightness}}
- Font family: {{Font family}}
- Elements to customize in ThemeData: {{Elements to customize in ThemeData}}
- Use Material 3 with useMaterial3 true: {{Use Material 3 with useMaterial3 true}}

Build the ColorScheme explicitly (ColorScheme.fromSeed from the primary, or a full scheme when all three colours are given) so surfaces and on-colours stay readable. Check text on primary and background meets contrast, and adjust the on-colours if not. For each chosen element, set shape, padding and colours with the current widget theme class names, such as CardThemeData where the Flutter version needs it. Apply the font through TextTheme so it reaches every text style.

Output one Dart file containing a single exported ThemeData, with a comment per section and a two-line usage example for MaterialApp.

## Pitfalls

- Using deprecated theme class names that fail on a current Flutter version.
- Setting colours without checking contrast, so button text is unreadable.
- Turning on Material 3 while still styling with Material 2 button themes.
