nyColorStyle<T> function

T nyColorStyle<T>(
  1. BuildContext context, {
  2. String? themeId,
})

Helper to get the color styles Find a color style from the Nylo's appThemes.

Example:

final colors = nyColorStyle<MyColorStyles>(context);
print(colors.primaryAccent);

Or get colors from a specific theme:

final colors = nyColorStyle<MyColorStyles>(context, themeId: 'dark_theme');

Implementation

T nyColorStyle<T>(BuildContext context, {String? themeId}) {
  if (themeId != null) {
    return NyThemeManager.instance.colorStylesFromTheme<T>(themeId);
  }
  return NyThemeManager.instance.colorStyles<T>();
}