styled-components / polished

A lightweight toolset for writing styles in JavaScript ✨
https://polished.js.org/
MIT License
7.64k stars 208 forks source link

steps in modularScale() is not calculated correctly #147

Closed boxfish closed 7 years ago

boxfish commented 7 years ago

Given default base (1em) and ratio (perfectFourth), modularScale(2) should return 1.77689em, but currently it is returning 2.666em.

It seems the current output is calculated by base * ratio * steps, but it should be base * Math.pow(ratio, steps)

yeskunall commented 7 years ago

Looks like this confirms what @boxfish reported. Based on modularscale.com, modular scale is calculated as base * Math.pow(ratio, steps).

Happy to make a PR if you'd like.

mxstbr commented 7 years ago

Yes please, PR very welcome!

brikou commented 7 years ago

@mxstbr I just made a PR for this one and another bug when steps is 0, can you review please #149

Thank you for your work :+1:

bhough commented 7 years ago

Closed by #149. Thanks @brikou!