customTheme method
void
customTheme({
- required String name,
- required NeomageColorScheme colors,
- NeomageTextTheme? text,
- NeomageComponentTheme? components,
- SyntaxTheme? syntax,
Register and activate a user-defined theme.
Implementation
void customTheme({
required String name,
required NeomageColorScheme colors,
NeomageTextTheme? text,
NeomageComponentTheme? components,
SyntaxTheme? syntax,
}) {
final theme = NeomageTheme(
info: ThemeInfo(
name: name,
displayName: name,
isDark: _looksLikeDark(colors),
),
colors: colors,
textTheme: text ?? NeomageTextTheme.defaults(color: colors.onBackground),
componentTheme: components ?? const NeomageComponentTheme(),
syntaxTheme: syntax ?? NeomageThemes.darkDefault.syntaxTheme,
);
_customThemes[name] = theme;
_currentTheme = theme;
_controller.add(_currentTheme);
}