tailwindcss-typography icon indicating copy to clipboard operation
tailwindcss-typography copied to clipboard

Golden ratio typography

Open jonathan-s opened this issue 5 years ago • 2 comments

I'd consider implementing golden ratio typography as detailed here: https://grtcalculator.com/

jonathan-s avatar May 12 '20 18:05 jonathan-s

Interesting idea @jonathan-s. Do you have any idea for what the API could be like?

benface avatar May 12 '20 20:05 benface

For font-size specifically it would be nice to be able to use a function.

theme: {
  fontSize: calculateGoldenRatio(1.6)
  ...
}

The output would be.

      xs: '0.97rem',
      sm: '1.25rem',
      base: '1.6rem',
      lg: '2rem',
      xl: '2.6rem',
      '2xl': '3.3rem',
      '3xl': '4.2rem',
      '4xl': '5.3rem',
      '5xl': '6.7rem',
      '6xl': '8.4rem',

If no function is provided the base is assumed to be 1 rem. Though my preference for the standard case would be 1.6rem. That coupled with html { font-size: 62.5% } would mean that 1rem is always equal to 10px which helps if you size things in other places in rem.

I haven't yet given much though for the margin stuff that is also included in the calculator.

jonathan-s avatar May 13 '20 07:05 jonathan-s