Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

modular-scale

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

modular-scale

Module for generating a modular scale.

  • 5.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.9K
increased by1335.18%
Maintainers
1
Weekly downloads
 
Created
Source

modular-scale

Module for generating a modular scale.

install

npm i modular-scale --save

use

var ModularScale = require('modular-scale')
var ms = ModularScale({
  ratio: ModularScale.ratios.goldenSection,
  base: '16px'
})

// Get a step up from the base font size in the scale
ms(4) // 109.656

// Get a step down from the base font size in the scale
ms(-1) // 9.889

// Get a rem or em relative value
ms(4, true) // 6.854

// Get an array of steps for use as pixel measurements
ms.steps(6) // [ 67.773, 41.887, 25.888, 16, 9.889, 6.112, 3.777 ]

// Also can return relative values for use with em, rem etc.
ms.steps(6, true) // [ 4.236, 2.618, 1.618, 1, 0.618, 0.382, 0.236 ]

Inspiration

Modular Scale

Keywords

FAQs

Package last updated on 16 Nov 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc