FlyColorGenerator class

Generates perceptually uniform, contextually aware 12-step color scales.

The generation process:

  1. Converts input colors to OKLCH for perceptual uniformity
  2. Finds two closest template scales using ΔE_OK color difference
  3. Blends templates using trigonometry to determine mixing ratio
  4. Corrects hue and chroma to match source color identity
  5. Transposes lightness curve to anchor to background using Bezier easing
  6. Generates alpha variants using reverse alpha blending

Usage

import 'package:flycolor/generator.dart';

final colors = FlyColorGenerator.generate(
  appearance: 'light',
  accent: '#3D63DD',
  gray: '#8B8D98',
  background: '#FFFFFF',
);

// Access the generated scales
colors.accentScale;      // 12-step accent scale
colors.grayScale;        // 12-step gray scale
colors.accentScaleAlpha; // Alpha variants
colors.accentContrast;   // Contrast color for text
colors.accentSurface;    // Surface color

Original Source: https://github.com/radix-ui/website/blob/main/components/generateRadixColors.tsx

Constructors

FlyColorGenerator()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

generate({required String appearance, required dynamic accent, required dynamic gray, required dynamic background}) GeneratedColors
Generate colors from base colors.
hexToColor(String hex) Color
Convert hex string to Color. Handles: