import 'package:flutter/material.dart';

extension AppColor on Color {
  static const primaryColor = Color(0xFF007AFF);
  static const primaryDarkColor = Color(0xFF1C1C1C);
  static const primaryLightColor = Color(0xFFFFFFFF);
  static const primarySelectedColor = Color(0xFFDFEEFF);
  static const baseTextColor = Color(0xFF7E869B);
  static const textFieldTextColor = Color(0xFF7E869B);
  static const textFieldLabelColor = Color(0xFF7E869B);
  static const textFieldHintColor = Color(0xFF757575);
  static const textFieldBorderColor = Color(0xfff2f3f5);
  static const textFieldFocusedBorderColor = Color(0xFF007AFF);
  static const loginTextFieldBorderColor = Color(0xFFF2F3F5);
  static const textFieldErrorBorderColor = Color(0xffE64646);
  static const loginTextFieldErrorBorder = Color(0xffE64646);
  static const loginTextFieldFocusedBorder = Color(0xFF007AFF);
  static const loginTextFieldHintColor = Color(0xff818C99);
  static const loginTextFieldBackgroundColor = Color(0xFFF2F3F5);
  static const appColor = Color(0xFF3840F7);
  static const nameUserColor = Color(0xFF182952);
  static const userInformationBackgroundColor = Color(0xFFF5F5F7);
  static const searchBorderColor = Color(0xFFEAEAEA);
  static const searchHintTextColor = Color(0xFF7E869B);
  static const mailboxSelectedBackgroundColor = Color(0xFFE6E5FF);
  static const mailboxBackgroundColor = Color(0xFFFFFFFF);
  static const mailboxSelectedTextColor = Color(0xFF3840F7);
  static const mailboxTextColor = Color(0xFF182952);
  static const emailMailboxContainColor = Color(0xFF162546);
  static const mailboxSelectedTextNumberColor = Color(0xFF182952);
  static const mailboxSelectedIconColor = Color(0xFF3840F7);
  static const mailboxIconColor = Color(0xFF7E869B);
  static const storageBackgroundColor = Color(0xFFF5F5F7);
  static const storageTitleColor = Color(0xFF7E869B);
  static const storageMaxSizeColor = Color(0xFF101D43);
  static const storageUseSizeColor = Color(0xFF2D0CFF);
  static const myFolderTitleColor = Color(0xFF7E869B);
  static const titleAppBarMailboxListMail = Color(0xFF182952);
  static const counterMailboxColor = Color(0xFF3840F7);
  static const backgroundCounterMailboxColor = Color(0xFFE3E1FD);
  static const backgroundCounterMailboxSelectedColor = Color(0x17313131);
  static const bgMailboxListMail = Color(0xFFFBFBFF);
  static const bgMessenger = Color(0xFFF2F2F5);
  static const textButtonColor = Color(0xFF182952);
  static const attachmentFileBorderColor = Color(0x1F000000);
  static const attachmentFileNameColor = Color(0xFF000000);
  static const attachmentFileSizeColor = Color(0xFF818C99);
  static const avatarColor = Color(0xFFF8F8F8);
  static const avatarTextColor = Color(0xFF3840F7);
  static const sentTimeTextColorUnRead = Color(0xFF182952);
  static const subjectEmailTextColorUnRead = Color(0xFF3840F7);
  static const dividerColor = Color(0xFFEAEAEA);
  static const bgComposer = Color(0xFFFBFBFF);
  static const emailAddressChipColor = Color(0x0D001C3D);
  static const enableSendEmailButtonColor = Color(0xFF007AFF);
  static const disableSendEmailButtonColor = Color(0xFFA9B4C2);
  static const borderLeftEmailContentColor = Color(0xFFEFEFEF);
  static const toastWarningBackgroundColor = Color(0xFFFFC107);
  static const toastSuccessBackgroundColor = Color(0xFF4BB34B);
  static const toastErrorBackgroundColor = Color(0xFFE64646);
  static const toastWithActionBackgroundColor = Color(0xFF3F3F3F);
  static const buttonActionToastWithActionColor = Color(0xFF7ADCF8);
  static const backgroundCountAttachment = Color(0x681C1C1C);
  static const bgStatusResultSearch = Color(0xFFF5F5F7);
  static const colorNameEmail = Color(0xFF000000);
  static const colorContentEmail = Color(0xFF6D7885);
  static const colorTextButton = Color(0xFF007AFF);
  static const colorHintSearchBar = Color(0xFF818C99);
  static const colorBgSearchBar = Color(0x99EBEDF0);
  static const colorBgIdentityButton = Color(0x00EBEDF0);
  static const colorShadowBgContentEmail = Color(0x14000000);
  static const colorDividerMailbox = Color(0x1F000000);
  static const colorCollapseMailbox = Color(0xFFB8C1CC);
  static const colorExpandMailbox = Color(0xFF007AFF);
  static const colorBgMailbox = Color(0xFFF7F7F7);
  static const colorFilterMessageDisabled = Color(0xFF99A2AD);
  static const colorFilterMessageEnabled = Color(0xFF007AFF);
  static const colorDefaultCupertinoActionSheet = Color(0x66000000);
  static const colorDisableMailboxCreateButton = Color(0x2E3C3C43);
  static const colorInputBorderErrorVerifyName = Color(0xFFE64646);
  static const colorInputBorderCreateMailbox = Color(0x1F000000);
  static const colorInputBackgroundErrorVerifyName = Color(0xFFFAEBEB);
  static const colorInputBackgroundCreateMailbox = Color(0xFFF2F3F5);
  static const colorHintInputCreateMailbox = Color(0xFFA9B4C2);
  static const colorMessageConfirmDialog = Color(0xFF6D7885);
  static const colorActionDeleteConfirmDialog = Color(0xFFE64646);
  static const colorActionCancelDialog = Color(0xFF007AFF);
  static const colorMessageDialog = Color(0xFF222222);
  static const colorConfirmActionDialog = Color(0xFFF2F2F2);
  static const colorEmailAddress = Color(0xFF333333);
  static const colorHintEmailAddressInput = Color(0x993C3C43);
  static const colorDividerComposer = Color(0xFFC6C6C8);
  static const colorDividerEmailView = Color(0xFFD7D8D9);
  static const colorButton = Color(0xFF959DAD);
  static const colorTime = Color(0xFF92A1B4);
  static const colorEmailAddressPrefix = Color(0xFF9AA7B6);
  static const colorEmailAddressTag = Color(0xFFF4F4F4);
  static const colorLineLeftEmailView = Color(0x2999A2AD);
  static const colorShadowComposer = Color(0x1F000000);
  static const colorBottomBarComposer = Color(0x5CEBEDF0);
  static const colorShadowComposerFullScreen = Color(0x33000000);
  static const colorCancelButton = Color(0xFFF2F2F2);
  static const colorTextButtonHeaderThread = Color(0xFF686E76);
  static const colorTextSettingDescriptions = colorTextButtonHeaderThread;
  static const colorButtonHeaderThread = Color(0x99EBEDF0);
  static const colorBorderBodyThread = Color(0x5CB8C1CC);
  static const colorBgDesktop = Color(0xFFF3F6F9);
  static const colorItemEmailSelectedDesktop = Color(0xFFDFEEFF);
  static const colorAvatar = Color(0xFFDE5E5E);
  static const colorFocusButton = Color(0x14818C99);
  static const colorBorderEmailAddressInvalid = Color(0xFFFF3347);
  static const colorBorderIdentityInfo = Color(0xFFE7E8EC);
  static const colorBgMailboxSelected = Color(0x99E4E8EC);
  static const colorLoading = Color(0x2999A2AD);
  static const colorBgMenuItemDropDownSelected = Color(0x80DEE2E7);
  static const colorButtonCancelDialog = Color(0x0D000000);
  static const colorShadowComposerButton = Color(0x99007AFF);
  static const colorBackgroundTagFilter = Color(0xFF6D7885);
  static const colorDefaultRichTextButton = Color(0xFF99A2AD);
  static const colorFocusRichTextButton = Color(0x146D7885);
  static const colorStyleBlockQuote = Color(0xFFEEEEEE);
  static const colorBorderStyleCode = Color(0xFFCCCCCC);
  static const colorBackgroundStyleCode = Color(0xFFF5F5F5);
  static const colorBorderWrapIconStyleCode = Color(0xFFE4E4E4);
  static const colorBackgroundWrapIconStyleCode = Color(0xFFF2F3F5);
  static const colorSelectedRichTextButton = Color(0x99EBEDF0);
  static const colorShadowDestinationPicker = Color(0x33000000);
  static const colorBackgroundSnackBar = Color(0xFF343438);
  static const colorBackgroundHeaderListRuleFilter = Color(0xFFFAF7F7);
  static const colorBorderListRuleFilter = Color(0xFFE7E8EC);
  static const colorBackgroundFieldConditionRulesFilter = Color(0xFFF2F3F5);
  static const colorDeletePermanentlyButton = Color(0xffE64646);
  static const colorVacationSettingExplanation = Color(0xFF686E76);
  static const colorBackgroundVacationSettingField = Color(0xFFF2F3F5);
  static const colorBackgroundNotificationVacationSetting= Color(0xFFFFF5C2);
  static const colorDivider = Color(0xFFE7E8EC);
  static const colorCloseButton = Color(0xFF818C99);
  static const colorDropShadow = Color(0x0F000000);
  static const colorBackgroundKeyboard = Color(0xFFD2D5DC);
  static const colorBackgroundKeyboardAndroid = Color(0xFFF2F0F4);
  static const colorShadowLayerBottom = Color(0x29000000);
  static const colorShadowLayerTop = Color(0x1F000000);
  static const colorDividerHorizontal = Color(0x1F000000);
  static const colorEmailAddressFull = Color(0xFF818C99);
  static const colorTitleHeaderAttachment = Color(0xFF818C99);
  static const colorAttachmentIcon = Color(0xFFAEB7C2);
  static const colorDividerDestinationPicker = Color(0x1F000000);
  static const colorItemAlreadySelected = Color(0xFF818C99);
  static const colorItemSelected = Color(0xFFF2F3F5);
  static const colorBorderSettingContentWeb = Color(0xFFE7E8EC);
  static const colorDividerHeaderSetting = Color(0xFFE4E4E4);
  static const colorSettingExplanation = Color(0xFF818C99);
  static const colorBackgroundContactTagItem = Color(0xFFDCE0E5);
  static const colorDeleteContactIcon = Color(0xFFAEB7C2);
  static const colorItemRecipientSelected = Color(0xFFDFEEFF);
  static const colorBackgroundQuotasWarning = Color(0xFFFFC107);
  static const colorQuotaWarning = Color(0xFFF05C44);
  static const colorQuotaError = Color(0xffE64646);
  static const colorCreateNewIdentityButton = Color(0xFFEBEDF0);
  static const colorSpamReportBannerBackground = Color(0xFFBFDEFF);
  static const colorSpamReportBannerStrokeBorder = Color(0x1F000000);
  static const colorSpamReportBannerLabelColor = Color(0xFF626D7A);
  static const colorSpamReportBannerButtonBackground = Color(0xFFEBEDF0);
  static const colorSubtitle = Color(0xFF6D7885);
  static const colorBackgroundSearchMailboxInput = Color(0xFFEBEDF0);
  static const colorMailboxHovered = Color(0xFFEBEDF0);
  static const colorMailboxPath = Color(0xFF818C99);
  static const colorIconUnSubscribedMailbox = Color(0xFFAEB7C2);
  static const colorTitleAUnSubscribedMailbox = Color(0xFF818C99);
  static const colorTitleSendingItem = Color(0xFF818C99);
  static const colorBannerMessageSendingQueue = Color(0xFFF7F8FA);
  static const colorDeliveringState = Color(0xFFAEB7C2);
  static const colorErrorState = Color(0xFFE64646);
  static const colorBackgroundErrorState = Color(0xFFFAEBEB);
  static const colorBackgroundDeliveringState = Color(0xFFF2F3F5);
  static const colorNetworkConnectionBannerBackground = Color(0x99EBEDF0);
  static const colorNetworkConnectionLabel = Color(0xFF818C99);
  static const colorCalendarEventRead = Color(0xFF818C99);
  static const colorCalendarEventUnread = Color(0xFF1C1B1F);
  static const colorMaybeEventActionText = Color(0xFFFFC107);
  static const colorMaybeEventActionBanner = Color(0xFFFFF5C2);
  static const colorInvitedEventActionText = Color(0xFF007AFF);
  static const colorInvitedEventActionBanner = Color(0xFFEBF4FF);
  static const colorUpdatedEventActionText = Color(0xFF4BB34B);
  static const colorUpdatedEventActionBanner = Color(0xFFECF8E5);
  static const colorCanceledEventActionText = Color(0xFFFF3347);
  static const colorCanceledEventActionBanner = Color(0xFFF5EBEB);
  static const colorSubTitleEventActionText = Color(0xFF939393);
  static const colorCalendarEventInformationBackground = Color(0x0A000000);
  static const colorCalendarEventInformationStroke = Color(0x1F000000);
  static const colorShadowCalendarDateIcon = Color(0x26000000);
  static const colorOrganizerMailto = Color(0xFFB3B3B3);
  static const colorMailto = Color(0xFFB3B3B3);
  static const colorEventDescriptionBackground = Color(0x05000000);
  static const colorLabelQuotas = Color(0xFF818C99);
  static const colorLabelCancelButton = Color(0xFFAEB7C2);
  static const colorCreateFiltersButton = Color(0xFFF3F3F7);
  static const colorTextBody = Color(0xFF818C99);
  static const colorClosePopupDialogButton = Color(0xFFAEB7C2);
  static const colorCancelPopupDialogButton = Color(0xFFEBEDF0);
  static const colorRemoveRuleFilterConditionButton = Color(0xFFE6E8EC);
  static const colorComposerShadowTop = Color(0x28000000);
  static const colorComposerShadowBottom = Color(0x1E000000);
  static const colorComposerAppBar = Color(0xFFF4F4F4);
  static const colorLabelComposer = Color(0xFF8B9CAF);
  static const colorLineComposer = Color(0xFFF4F4F4);
  static const colorPrefixButtonComposer = Color(0xFF8B9CAF);
  static const colorRichButtonComposer = Color(0xFFAEAEC0);
  static const colorSelected = Color(0xFFE3F1FF);
  static const colorAttachmentBorder = Color(0xFFE5ECF3);
  static const colorProgressLoadingBackground = Color(0xFFE3F1FF);
  static const colorDropZoneBackground = Color(0xFFF6FAFF);
  static const colorDropZoneBorder = Color(0xFF46A2FF);
  static const colorLabelRichText = Color(0xFFADADC0);
  static const dropdownButtonBorderColor = Color(0xFFCFD7E2);
  static const dropdownLabelButtonBackgroundColor = Color(0xFFF4F4F4);
  static const colorLabelMoreAttachmentsButton = Color(0xFF71767C);
  static const colorButtonBorder = Color(0xFFD5D7E0);
  static const colorScrollbarTrackColor = Color(0xFFF4EFF4);
  static const colorScrollbarThumbColor = Color(0xFFD8E1EB);
  static const colorDropDownTitleComposer = Color(0xFF79747E);
  static const colorDropDownItemTitleComposer = Color(0xFF0A0A0A);
  static const messageDialogColor = Color(0xFF8C9CAF);
  static const messageDialogHighlightColor = Color(0xFF37383A);
  static const labelColor = Color(0xFF71767C);
  static const thumbScrollbarColor = Color(0xFFC1C1C1);
  static const loginViewShadowColor = Color(0x3DBCBCBC);
  static const colorEmailTileCheckboxUnhover = Color(0xFFAEB7C2);
  static const colorSearchFilterButton = Color(0xFFECEEF1);
  static const colorSearchFilterTitle = Color(0xFF686E76);
  static const colorSearchFilterIcon = Color(0xFF686E76);
  static const colorSuggestionSearchFilterButton = Color(0xFFEBEDF0);
  static const colorFilterMessageButton = Color(0xFFEBEDF0);
  static const colorFilterMessageIcon = Color(0xFF686E76);
  static const colorFilterMessageTitle = Color(0xFF686E76);
  static const colorStarredSearchFilterIcon = Color(0xFFFFCC00);
  static const colorMobileSearchFilterButton = Color(0xFFEBEDF0);
  static const colorContactViewClearFilterButton = Color(0x001C3D0D);
  static const steelGrayA540 = Color(0xFF55687D);
  static const steelGray200 = Color(0xFFAEB7C2);
  static const blue700 = Color(0xFF208BFF);
  static const steelGray400 = Color(0xFF818C99);
  static const steelGray600 = Color(0xFF4E5966);
  static const blue100 = Color(0xFFDFEEFF);
  static const blue400 = Color(0xFF80BDFF);
  static const m3Tertiary = Color(0xFF8C9CAF);
  static const m3Neutral70 = Color(0xFFAEAAAE);
  static const grayBackgroundColor = Color(0xFFF3F6F9);
  static const m3SurfaceBackground = Color(0xFF1C1B1F);

  static const mapGradientColor = [
    [Color(0xFF21D4FD), Color(0xFFB721FF)],
    [Color(0xFF38F9D7), Color(0xFF43E97B)],
    [Color(0xFF11E6F0), Color(0xFF4FACFE)],
    [Color(0xFFE88395), Color(0xFFEF9C8F)],
    [Color(0xFF8DDAD5), Color(0xFF00CDAC)],
    [Color(0xFFE4ABF0), Color(0xFFD96EED)],
    [Color(0xFFF0FF00), Color(0xFF58CFFB)],
    [Color(0xFFEFC0D7), Color(0xFF1AD5E4)],
    [Color(0xFFFFD26F), Color(0xFF3677FF)],
    [Color(0xFF87A6F8), Color(0xFF645FF6)],
  ];

  String toHexTriplet() => '#${(value & 0xFFFFFF)
      .toRadixString(16)
      .padLeft(6, '0')
      .toUpperCase()}';

  static List<Color> get listColorsPicker {
    return [
      ...Colors.grey.listShadeColors,
      ...listMaterialColors.map((color) => color.shade900).toList(),
      ...listMaterialColors.map((color) => color.shade800).toList(),
      ...listMaterialColors.map((color) => color.shade700).toList(),
      ...listMaterialColors.map((color) => color.shade600).toList(),
      ...listMaterialColors.map((color) => color.shade500).toList(),
      ...listMaterialColors.map((color) => color.shade400).toList(),
      ...listMaterialColors.map((color) => color.shade300).toList(),
      ...listMaterialColors.map((color) => color.shade200).toList(),
      ...listMaterialColors.map((color) => color.shade100).toList(),
      ...listMaterialColors.map((color) => color.shade50).toList(),
    ];
  }

  static List<MaterialColor> get listMaterialColors {
    return [
      Colors.cyan,
      Colors.blue,
      Colors.deepPurple,
      Colors.purple,
      Colors.pink,
      Colors.red,
      Colors.deepOrange,
      Colors.orange,
      Colors.amber,
      Colors.yellow,
      Colors.lime,
      Colors.green
    ];
  }
}

extension ColorNullableExtension on Color? {
  ColorFilter? asFilter({BlendMode? blendMode}) {
    if (this == null) {
      return null;
    } else {
      return ColorFilter.mode(this!, blendMode ?? BlendMode.srcIn);
    }
  }
}

extension MaterialColorExtension on MaterialColor {

  List<Color> get listShadeColors {
    return [
      const Color(0xFFFFFFFF),
      const Color(0xFFFCFCFC),
      shade50,
      shade100,
      shade200,
      shade300,
      shade400,
      shade500,
      shade600,
      shade700,
      shade800,
      shade900
    ];
  }
}