content: /* Copyright (C) 2024-2025 Ilias Koukovinis <ilias.koukovinis@gmail.com>
   *
   * This program is free software: you can redistribute it and/or modify
   * it under the terms of the GNU Affero General Public License as
   * published by the Free Software Foundation, either version 3 of the
   * License, or (at your option) any later version.
   * 
   * This program is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   * GNU Affero General Public License for more details.
   * 
   * You should have received a copy of the GNU Affero General Public License
   * along with this program. If not, see <https://www.gnu.org/licenses/>.
   */
  
  import 'package:flutter/material.dart';
  
  /// Color nomenclature (i.e. hierarchy) inspired by protein structure levels.
  /// A fan parallel/resemblance I found:
  ///
  /// ```text
  /// +-------------------+----------------------------------------+----------------+
  /// | Protein Structure | Description                            | Color Analogy  |
  /// +-------------------+----------------------------------------+----------------+
  /// | Primary           | Sequence of amino acids                | primaryColor   |
  /// | Secondary         | Local folding (e.g., alpha helices)    | secondaryColor |
  /// | Tertiary          | 3D structure of a single polypeptide   | tertiaryColor  |
  /// | Quaternary        | Assembly of multiple polypeptides      | quaternaryColor|
  /// | (No analog)       | —                                      | inferiorColor  |
  /// +-------------------+----------------------------------------+----------------+
  /// ```
  class AppColors extends ThemeExtension<AppColors> {
    final Color primaryColor;
    final Color secondaryColor;
    final Color tertiaryColor;
    final Color quaternaryColor;
    final Color inferiorColor;
  
    const AppColors({
      required this.primaryColor,
      required this.secondaryColor,
      required this.tertiaryColor,
      required this.quaternaryColor,
      required this.inferiorColor,
    });
  
    @override
    AppColors copyWith({
      Color? primaryColor,
      Color? secondaryColor,
      Color? tertiaryColor,
      Color? quaternaryColor,
      Color? inferiorColor,
    }) {
      return AppColors(
        primaryColor: primaryColor ?? this.primaryColor,
        secondaryColor: secondaryColor ?? this.secondaryColor,
        tertiaryColor: tertiaryColor ?? this.tertiaryColor,
        quaternaryColor: quaternaryColor ?? this.quaternaryColor,
        inferiorColor: inferiorColor ?? this.inferiorColor,
      );
    }
  
    @override
    AppColors lerp(ThemeExtension<AppColors>? other, double t) {
      if (other is! AppColors) return this;
      return AppColors(
        primaryColor: Color.lerp(primaryColor, other.primaryColor, t)!,
        secondaryColor: Color.lerp(secondaryColor, other.secondaryColor, t)!,
        tertiaryColor: Color.lerp(tertiaryColor, other.tertiaryColor, t)!,
        quaternaryColor: Color.lerp(quaternaryColor, other.quaternaryColor, t)!,
        inferiorColor: Color.lerp(inferiorColor, other.inferiorColor, t)!,
      );
    }
  }
  