Packages@accelint/converters
Overview
A lightweight JavaScript utility for converting between various value types, including colors, booleans, numbers, geographic coordinates, and map tile coordinates.
Installation
pnpm add @accelint/convertersUsage
// Import from root (all exports)
import {
hexToRgba255Tuple,
rgba255TupleToHex,
booleanToNumber,
toBoolean
} from '@accelint/converters';
// Import from sub-modules
import { hexToRgba255Tuple } from '@accelint/converters/hex';
import { cssRgbaStringToRgba255Tuple } from '@accelint/converters/css-rgba';
import { glslToRgba255Tuple } from '@accelint/converters/glsl';Available Exports
| Export Path | Description |
|---|---|
| boolean-to-number | Convert boolean values to numeric representations (0/1) |
| css-rgba | Convert between CSS rgba strings/objects and RGBA 0-255 tuples |
| glsl | Convert between GLSL normalized colors (0-1) and RGBA 0-255 tuples |
| hex | Convert between hex color strings and RGBA 0-255 tuples |
| to-boolean | Convert various value types to boolean |
| zxy-to-bbox | Convert map tile coordinates (z/x/y) to bounding box coordinates |
Related
- @accelint/constants - Color and coordinate constants
- @accelint/predicates - Value validation predicates
- GitHub Repository - Source code