1import { Curve } from "./ref/curves"
2
3export interface ColorAccessiblityValue {
4 value: number
5 aaPass: boolean
6 aaaPass: boolean
7}
8
9/**
10 * Calculates the color contrast between a specified color and its corresponding background and foreground colors.
11 *
12 * @note This implementation is currently basic – Currently we only calculate contrasts against black and white, in the future will allow for dynamic color contrast calculation based on the colors present in a given palette.
13 * @note The goal is to align with WCAG3 accessibility standards as they become stabilized. See the [WCAG 3 Introduction](https://www.w3.org/WAI/standards-guidelines/wcag/wcag3-intro/) for more information.
14 */
15export interface ColorAccessiblity {
16 black: ColorAccessiblityValue
17 white: ColorAccessiblityValue
18}
19
20export type Color = {
21 step: number
22 contrast: ColorAccessiblity
23 hex: string
24 lch: number[]
25 rgba: number[]
26 isLight: boolean
27}
28
29export interface ColorScale {
30 colors: Color[]
31 // An array of hex values for each color in the scale
32 values: string[]
33}
34
35export type ColorFamily = {
36 name: string
37 scale: ColorScale
38 invertedScale: ColorScale
39}
40
41export interface ColorFamilyHue {
42 start: number
43 end: number
44 curve: Curve
45}
46
47export interface ColorFamilySaturation {
48 start: number
49 end: number
50 curve: Curve
51}
52
53export interface ColorFamilyLightness {
54 start: number
55 end: number
56 curve: Curve
57}
58
59export interface ColorFamilyConfig {
60 name: string
61 color: {
62 hue: ColorFamilyHue
63 saturation: ColorFamilySaturation
64 lightness: ColorFamilyLightness
65 }
66}