Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tychota/teinte
https://github.com/tychota/teinte
Last synced: 2 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/tychota/teinte
- Owner: tychota
- License: mit
- Created: 2023-10-04T14:57:59.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-12-21T14:15:59.000Z (11 months ago)
- Last Synced: 2023-12-21T16:49:16.772Z (11 months ago)
- Language: TypeScript
- Size: 231 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Teinte
Teinte is a library to handle color interpolation.
Usage:
```ts
import { interpolateColor } from "@bam.tech/teinte";const color1 = { r: 255, g: 0, b: 0 };
const color2 = { r: 0, g: 255, b: 0 };
const ratio = 0.5;
const colorspace = "oklab";
const gamutMapping = "adaptativeL05-5";const color = interpolateColor(color1, color2, ratio, colorspace, gamutMapping);
```Arguments are:
- color1: first RGB color
- color2: second RGB color
- ratio: interpolation ratio between 0 and 1
- colorspace: colorspace to use for interpolation. Can be "rgb" | "hsl" | "oklab" | "oklch". Is "oklab" by default
- gamutMapping: gamut mapping to use for interpolation. Can be "clamp" | "gray" | "preserveChroma" | "projectTo05" | "projectToLCusp" | "adaptativeL05-005" | "adaptativeL05-05" | "adaptativeL05-5" | "adaptativeLcusp-005" | "adaptativeLcusp-05" | "adaptativeLcusp-5"See https://bottosson.github.io/posts/gamutclipping/ for more information about gamut mapping.
## Development
To install dependencies:
```bash
bun install
```To run:
```bash
bun run index.ts
```This project was created using `bun init` in bun v1.0.3. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.