Organize
This commit is contained in:
@@ -1,31 +1,7 @@
|
|||||||
// Adapted from @k-vyn/coloralgorithm
|
// Adapted from @k-vyn/coloralgorithm
|
||||||
|
|
||||||
import chroma, { Scale } from "chroma-js";
|
import chroma, { Scale } from "chroma-js";
|
||||||
|
import { ColorFamily, ColorProps, ColorSet } from "./types";
|
||||||
export type Color = {
|
|
||||||
step: number;
|
|
||||||
hex: string;
|
|
||||||
lch: number[];
|
|
||||||
rgbaArray: number[];
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ColorSet = Color[];
|
|
||||||
export type ColorFamily = {
|
|
||||||
name: string;
|
|
||||||
colors: string[];
|
|
||||||
invertedColors: string[];
|
|
||||||
colorsMeta: ColorSet;
|
|
||||||
invertedMeta: ColorSet;
|
|
||||||
};
|
|
||||||
|
|
||||||
export interface ColorProps {
|
|
||||||
name: string;
|
|
||||||
color: {
|
|
||||||
start: string;
|
|
||||||
middle: string;
|
|
||||||
end: string;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function validColor(color: string) {
|
function validColor(color: string) {
|
||||||
if (chroma.valid(color)) {
|
if (chroma.valid(color)) {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import * as chroma from "chroma-js";
|
import chroma from "chroma-js";
|
||||||
import { ColorFamily, generateColorSet } from "../algorithm";
|
import { generateColorSet } from "../algorithm";
|
||||||
|
import { ColorFamily } from "../types";
|
||||||
|
|
||||||
// Colors should use the LCH color space.
|
// Colors should use the LCH color space.
|
||||||
// https://www.w3.org/TR/css-color-4/#lch-colors
|
// https://www.w3.org/TR/css-color-4/#lch-colors
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
export type Color = {
|
||||||
|
step: number;
|
||||||
|
hex: string;
|
||||||
|
lch: number[];
|
||||||
|
rgbaArray: number[];
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ColorSet = Color[];
|
||||||
|
export type ColorFamily = {
|
||||||
|
name: string;
|
||||||
|
colors: string[];
|
||||||
|
invertedColors: string[];
|
||||||
|
colorsMeta: ColorSet;
|
||||||
|
invertedMeta: ColorSet;
|
||||||
|
};
|
||||||
|
|
||||||
|
export interface ColorProps {
|
||||||
|
name: string;
|
||||||
|
color: {
|
||||||
|
start: string;
|
||||||
|
middle: string;
|
||||||
|
end: string;
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user