pollen-css
Version:
Utility-first CSS for the future
17 lines (15 loc) • 368 B
text/typescript
/**
* Fluid size utility
*/
export function fluid(
minSize: number,
maxSize: number,
minWidth = 480,
maxWidth = 1280,
) {
const slope = (maxSize - minSize) / (maxWidth - minWidth);
const yAxisIntersection = -minWidth * slope + minSize;
return `clamp(${minSize / 16}rem, ${yAxisIntersection / 16}rem + ${
slope * 100
}vw, ${maxSize / 16}rem)`;
}