design-math-node
v0.1.9
Published
Native Node.js bindings for design-math.
Maintainers
Readme
design-math-node
Native Node.js bindings for design-math.
This package exposes the shared design-math API as direct Node function calls.
It is meant for:
- agent workflows
- build tooling
- scripts
- server-side automation
Status
The package implementation is complete in this repo and passes:
- runtime smoke tests
- parity tests against the shared fixture set
- pack/install/require smoke tests
The npm release flow now ships a main design-math-node package plus prebuilt platform packages.
Install
npm install design-math-nodeCurrently published prebuilt targets are:
- macOS arm64
- macOS x64
- Linux x64 glibc
- Windows x64 MSVC
Try it locally
cd bindings/node
npm packThen install the generated tarball into your project.
Public API
This package exposes:
convertColoranalyzeColorcontrastColormanipulateColormixColorsgenerateColorScalegenerateColorHarmonygeneratePalettegenerateSchemegenerateTypeScalegenerateFluidScalegenerateFluidTypequeryLetterSpacingconvertTypeUnitsgenerateShadowSystem
Example
const math = require('design-math-node')
const result = math.convertColor('#c96442')
console.log(result.oklch)
const contrast = math.contrastColor(
'rgba(255,255,255,0.5)',
'rgba(0,0,0,0.5)',
{ backdrop: '#111111' },
)
console.log(contrast.wcag.ratio)
const palette = math.generatePalette({
bg: '#f5f4ed',
fg: '#141413',
brand: '#c96442',
})
console.log(palette.tokens.primary.hex)Notes
- Input option objects use
camelCase - Result objects keep the shared
snake_casefield names - The result shape is intended to stay aligned with CLI
--json - The npm package uses optional platform packages under the hood
For the full JS integration guide, see ../../docs/javascript-bindings.md.
License
This package is licensed for free use, copying, and redistribution in unmodified form for personal or commercial purposes. Modification and derivative works are not permitted. See LICENSE for the full terms.
