1.0.2 • Published 5 years ago

ms-ratios v1.0.2

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

modularscale-ratios

Based on the work by Scott Kellum and Tim Brown.

These ratios are intended to be used with a modular scale for visual design. See modularscale.com for more details.

Usage

// 1. import the ratios along with modularscale-js
import modularscale-ratios as ratios from 'modularscale-ratios';
import ms from 'modularscale-js'; // see https://github.com/modularscale/modularscale-js/

// 2. choose a base and ratio
const $ratio = {
    base: 16,
    ratio: ratios.perfectFourth // choose any ratio from the predefined list
};

// 3. use the modular scale to give proportion to your design
const myBodyFontSize = ms(0, $ratio);
const myHeadingFontSize = ms(3, $ratio);
// ...

Available Ratios

NameJavaScript NameRatio
Minor SecondminorSecond16/15
Major SecondmajorSecond1.125
Minor ThirdminorThird1.2
Major ThirdmajorThird1.25
Perfect FourthperfectFourth4/3
Aug FourthaugFourth1.414
Perfect FifthperfectFifth1.5
Minor SixthminorSixth1.6
Golden SectiongoldenSection1.61803398875
Major SixthmajorSixth5/3
Minor SeventhminorSeventh16/9
Major SeventhmajorSeventh1.875
Octaveoctave2
Major TenthmajorTenth2.5
Major EleventhmajorEleventh8/3
Major TwelfthmajorTwelfth3
Double OctavedoubleOctave4