Flutter Theme Consumption
Use Visor's generated ThemeData in your Flutter app via the visor_themes package.
Visor generates Material 3 ThemeData for all 11 themes (4 stock + 7 custom) into a single
packages/visor_themes/ package. Each theme exposes a .light and .dark ThemeData via the
VisorThemes sealed class.
Setup
Add visor_themes as a path dependency in your pubspec.yaml:
dependencies:
visor_themes:
path: ../visor_themes # adjust relative path as neededIf visor_core is not yet on pub.dev, add a path override in pubspec_overrides.yaml:
dependency_overrides:
visor_core:
path: ../visor-flutterRun flutter pub get to resolve.
Basic Usage
import 'package:flutter/material.dart';
import 'package:visor_themes/visor_themes.dart';
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: VisorThemes.blackout.light,
darkTheme: VisorThemes.blackout.dark,
home: const HomePage(),
);
}
}Available Themes
| Getter | Theme |
|---|---|
VisorThemes.blackout | Blackout (stock) |
VisorThemes.modernMinimal | Modern Minimal (stock) |
VisorThemes.neutral | Neutral (stock) |
VisorThemes.space | Space (stock) |
VisorThemes.blacklight | Blacklight |
VisorThemes.blacklightUnderground | Blacklight Underground |
VisorThemes.entr | ENTR |
VisorThemes.kaiah | Kaiah |
VisorThemes.referenceApp | Reference App |
VisorThemes.solespark | SoleSpark |
VisorThemes.veronica | Veronica Home |
VisorThemePair
Each getter returns a VisorThemePair:
class VisorThemePair {
final ThemeData light;
final ThemeData dark;
}Accessing VisorColorsData
The VisorColorsData ThemeExtension is automatically attached to every ThemeData:
final colors = Theme.of(context).extension<VisorColorsData>()!;
Text('Hello', style: TextStyle(color: colors.textPrimary));Regenerating Themes
Themes are generated from .visor.yaml files in themes/ (stock) and custom-themes/ (custom).
To regenerate after changing a YAML:
npm run themes:apply-flutterThis runs visor theme batch-apply-flutter which:
- Discovers all
.visor.yamlfiles inthemes/andcustom-themes/ - Calls the flutter adapter for each
- Writes token files to
packages/visor_themes/lib/src/<slug>/ - Regenerates the
lib/visor_themes.dartmeta-barrel
The script is idempotent — re-running produces identical output.
Custom Themes
Add a new .visor.yaml to custom-themes/ with at minimum name and colors.primary:
name: my-app
version: 1
group: Custom
colors:
primary: "#6366F1"Then run npm run themes:apply-flutter. A new VisorThemes.myApp getter will appear.