switchColor method

dynamic switchColor(
  1. Color color, {
  2. bool persist = true,
})

Implementation

switchColor(final Color color, {bool persist = true}) {
  if (color == primaryColor()) return;
  Pen.success("Changing color from $primaryColor to $color");
  colorPickerMode(false);
  primaryColor(color);
  lightTheme(themeConfig.theme(isDark: false, color: color));
  darkTheme(themeConfig.theme(isDark: true, color: color));
  if (persist) {
    _configService
        .setConfig(_configService.item.copyWith(primaryColor: color.value));
  }
}