mirror of
https://github.com/Ku6epXBOCTuK/easy-png-tools.git
synced 2026-11-13 17:08:20 +00:00
refactor: clamp\storage dry
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { ToolError } from "./errors";
|
||||
import type { PixelImage } from "./types";
|
||||
import { createPixelImage } from "./types";
|
||||
import { clamp01 } from "./math";
|
||||
|
||||
export type Rgb = { r: number; g: number; b: number };
|
||||
export type Hsl = { h: number; s: number; l: number };
|
||||
@@ -180,10 +181,6 @@ export function sortPalette(hexes: string[], key: SortKey): string[] {
|
||||
.map((s) => s.h);
|
||||
}
|
||||
|
||||
function clamp01(v: number): number {
|
||||
return Math.min(1, Math.max(0, v));
|
||||
}
|
||||
|
||||
/** Horizontal equal swatch columns (strip) or a grid of ~square cells (grid). */
|
||||
export function renderSwatches(
|
||||
colors: string[],
|
||||
|
||||
Reference in New Issue
Block a user