Last active
September 30, 2021 13:22
-
-
Save VJAI/f4240f0353bf992d967f52f74844d963 to your computer and use it in GitHub Desktop.
Font Size Calculator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const base = 19; | |
const ratio = 1.618; | |
const interval = 5; | |
function size(point) { | |
const s = base * Math.pow(ratio, point/interval); | |
return [s, `${(s / base).toFixed(3)} rem`]; | |
} | |
for (let i = -10; i < 20; i++) { | |
console.log(size(i)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment