/** * Color schemas using Effect Schema * * All color types are defined using Effect Schema and TypeScript types are derived from them. * This ensures runtime validation matches compile-time types. * * Uses culori for color parsing and validation to ensure consistency with conversion functions. */ import { Effect, Schema } from "effect"; import { ColorConversionError, ColorParseError } from "../domain/color/errors.js"; /** * OKLCH Color Schema * * OKLCH (Oklabch) is a perceptually uniform color space * * - l: Lightness [0, 1] where 0 is black and 1 is white * - c: Chroma (colorfulness) [0, ~0.4] where 0 is achromatic * - h: Hue angle in degrees [0, 360) * - alpha: Transparency [0, 1] */ export declare const OKLCHColorSchema: Schema.Struct<{ l: Schema.refine>; c: Schema.refine>; h: Schema.refine>; alpha: Schema.optionalWith>, { default: () => number; }>; }>; export declare const OKLCHColor: (u: unknown, overrideOptions?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<{ readonly l: number; readonly c: number; readonly h: number; readonly alpha: number; }, import("effect/ParseResult").ParseError, never>; export type OKLCHColor = typeof OKLCHColorSchema.Type; /** * RGB Color Schema * * - r: Red channel [0, 255] * - g: Green channel [0, 255] * - b: Blue channel [0, 255] * - alpha: Transparency [0, 1] */ export declare const RGBColorSchema: Schema.Struct<{ r: Schema.refine>>; g: Schema.refine>>; b: Schema.refine>>; alpha: Schema.optionalWith>, { default: () => number; }>; }>; export declare const RGBColor: (u: unknown, overrideOptions?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<{ readonly alpha: number; readonly r: number; readonly g: number; readonly b: number; }, import("effect/ParseResult").ParseError, never>; export type RGBColor = typeof RGBColorSchema.Type; /** * Hex Color Schema (branded string) * * Format: #RRGGBB or #RRGGBBAA * Uses culori.parse for validation to ensure the color is actually parseable */ export declare const HexColorSchema: Schema.brand>, "HexColor">; export declare const HexColor: (u: unknown, overrideOptions?: import("effect/SchemaAST").ParseOptions) => Effect.Effect, import("effect/ParseResult").ParseError, never>; export type HexColor = typeof HexColorSchema.Type; /** * General color string input schema (accepts various formats) * * Accepts hex, rgb(), hsl(), oklch(), etc. - anything culori can parse * Also accepts hex colors without # prefix (e.g., "2D72D2") */ export declare const ColorStringSchema: Schema.brand, "ColorString">; export declare const ColorString: (u: unknown, overrideOptions?: import("effect/SchemaAST").ParseOptions) => Effect.Effect, import("effect/ParseResult").ParseError, never>; export type ColorString = typeof ColorStringSchema.Type; /** * Parse a color string to OKLCH using culori * * Returns an Effect that can fail with ColorParseError or ColorConversionError */ export declare const parseColorStringToOKLCH: (colorString: string) => Effect.Effect; /** * OKLAB Color Schema * * OKLAB is the rectangular form of OKLCH * * - l: Lightness [0, 1] * - a: Green-red axis * - b: Blue-yellow axis * - alpha: Transparency [0, 1] */ export declare const OKLABColorSchema: Schema.Struct<{ l: Schema.refine>; a: Schema.SchemaClass; b: Schema.SchemaClass; alpha: Schema.optionalWith>, { default: () => number; }>; }>; export declare const OKLABColor: (u: unknown, overrideOptions?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<{ readonly l: number; readonly alpha: number; readonly b: number; readonly a: number; }, import("effect/ParseResult").ParseError, never>; export type OKLABColor = typeof OKLABColorSchema.Type; /** * Color Space Schema */ export declare const ColorSpaceSchema: Schema.Literal<["hex", "rgb", "oklch", "oklab"]>; export declare const ColorSpace: (u: unknown, overrideOptions?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<"hex" | "rgb" | "oklch" | "oklab", import("effect/ParseResult").ParseError, never>; export type ColorSpace = typeof ColorSpaceSchema.Type; //# sourceMappingURL=color.d.ts.map