> ## Documentation Index
> Fetch the complete documentation index at: https://starrycodes.mintlify.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Color - The Color Calculator

> Extensions for quick color manipulation, contrast checking (luminance), Hex conversion, and instant MaterialColor swatch generation.

<Steps titleSize="h3">
  <Step title="💡 Accessibility & Contrast">
    <ResponseField name="luminance" type="double">
      The relative luminance of the color (0.0=black, 1.0=white). Essential for contrast calculations.

      ```dart lines wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
      final lum = myColor.luminance; // 0.0 - 1.0
      ```
    </ResponseField>

    <ResponseField name="isDark" type="bool">
      Checks if the color is perceived as dark (`luminance` \< 0.5). Use this to decide if white text should be used.

      ```dart lines wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
      final needsWhiteText = Colors.black.isDark; // true
      ```
    </ResponseField>

    <ResponseField name="isLight" type="bool">
      Checks if the color is perceived as light (`luminance` ≥ 0.5). Use this to decide if dark text should be used.

      ```dart lines wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
      final needsDarkText = Colors.yellow.isLight; // true
      ```
    </ResponseField>
  </Step>

  <Step title="⚙️ Manipulation & Conversion">
    <ResponseField name="getLighterShade(double factor)" type="Color">
      Lightens the color by a specified `factor` (0.0 to 1.0). Alpha channel is preserved.

      ```dart lines wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
      final lighterBlue = Colors.blue.getLighterShade(0.2);
      ```
    </ResponseField>

    <ResponseField name="toHex({bool hashSign, bool withAlpha})" type="String">
      Converts the color to its hexadecimal string representation.

      ```dart lines wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
      // Returns #2196F3;
      Colors.blue.toHex();
      ```
    </ResponseField>
  </Step>

  <Step title="🎨 The Swatch Creator">
    <ResponseField name="toMaterialColor" type="MaterialColor">
      Generates a full 10-shade `MaterialColor` swatch (50-900) from a single base color. The ultimate shortcut for `ThemeData.primarySwatch`.

      ```dart lines wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
      final customSwatch = Color(0xFF1ABC9C).toMaterialColor;
      ```
    </ResponseField>
  </Step>
</Steps>
