docs/lib/remToPx.ts
2024-07-22 11:49:47 +02:00

11 lines
291 B
TypeScript

export function remToPx(remValue: number) {
const rootFontSize =
typeof window === "undefined"
? 16
: Number.parseFloat(
window.getComputedStyle(document.documentElement).fontSize,
);
return remValue * rootFontSize;
}