import 'dart:ui';

class AppColors {
  static final HexColor primary1 = HexColor('#60BA69');
  static final HexColor primary2 = HexColor('#F7893A');
  static final HexColor primary3 = HexColor('#EAF6EB');

  static final HexColor accent1 = HexColor('#2F80ED');
  static final HexColor accent2 = HexColor('#E3EEFD');
  static final HexColor accent3 = HexColor('#60BA69');
  static final HexColor accent4 = HexColor('#EAF6EB');
  static final HexColor accent5 = HexColor('#F7893A');
  static final HexColor accent6 = HexColor('#FEEDE2');
  static final HexColor accent7 = HexColor('#EB0A1E');
  static final HexColor accent8 = HexColor('#FDE2E2');
  static final HexColor accent9 = HexColor('#2D3748');
  static final HexColor accent10 = HexColor('#E2E8F0');
  static final HexColor accent11 = HexColor('#E2E4E7');

  static final HexColor neutral1 = HexColor('#2D3748');
  static final HexColor neutral2 = HexColor('#9DA5AF');
  static final HexColor neutral3 = HexColor('#A0AEC0');
  static final HexColor neutral4 = HexColor('#E2E8F0');
  static final HexColor neutral5 = HexColor('#F5F5F5');
  static final HexColor neutral7 = HexColor('#F2F4F8');
  static final HexColor neutral9 = HexColor('#6E7987');
  static final HexColor neutral10 = HexColor('#2F80ED');
  static final HexColor neutral11 = HexColor('#E3EEFD');
  static final HexColor neutral13 = HexColor('#EAF6EB');
  static final HexColor neutral14 = HexColor('#E6ECFA');
  static final HexColor neutral15 = HexColor('#FEEDE2');
  static final HexColor neutral16 = HexColor('#F7893A');
  static final HexColor neutral17 = HexColor('#DEE3ED');
  static final HexColor neutral18 = HexColor('#FDE2E2');

  static final HexColor semantic1 = HexColor('#F7BE0C');
  static final HexColor semantic2 = HexColor('#EB0A1E');
  static final HexColor semantic3 = HexColor('#232323');
  static final HexColor semantic4 = HexColor('#3A3A3A');
  static final HexColor semantic5 = HexColor('#004CDE');
  static final HexColor semantic6 = HexColor('#F65555');
  static final HexColor semantic7 = HexColor('#FDE2E2');

  static final HexColor white = HexColor('#FFFFFF');
  static final HexColor black = HexColor('#101010');
  static final HexColor border = HexColor('#EEEEEE');

  static final HexColor background1 = HexColor('#F2F4F8');
  static final HexColor background2 = HexColor('#EAF6EB');
  static final HexColor background3 = HexColor('#EEFDFE');
}

class HexColor extends Color {
  static int _getColorFromHex(String hexColor) {
    try {
      hexColor = hexColor.toUpperCase().replaceAll('#', '');
      if (hexColor.length == 6) {
        hexColor = 'FF' + hexColor;
      } else if (hexColor.length == 5) {
        hexColor = 'FF' + hexColor + '0';
      }
      return int.parse(hexColor, radix: 16);
    } catch (_) {
      return int.parse('FFFFFF', radix: 16);
    }
  }

  HexColor(final String hexColor) : super(_getColorFromHex(hexColor));
}
