Socket
Socket
Sign inDemoInstall

consonance

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

consonance

Fix your typographic scale


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Turns a mess of font sizes into a nice consistent scale.

Usage

Pass in an array of your current font sizes, and some options to generate a modular scale.

var consonance = require('consonance');

var input = [10, 15, 17, 22, 23, 24, 34, 37, 47, 50, 68, 74];

var options = {
  base: 16,
  ratios: [3/2, 4/3],
  length: 8
}

consonance(input, options);

Alternatively, provide own typographic scale as an array of pixel sizes.

var consonance = require('consonance');

var input = [10, 15, 17, 22, 23, 24, 34, 37, 47, 50, 68, 74];

var scale = [10, 16, 24, 36, 48, 72];

consonance(input, scale);

Consonance returns an array of objects containing the "input" and what we transformed it to. WIP - data structure might change before 1.0.0.

[ { "input": 10, "output": 10, "i": 0 },
  { "input": 15, "output": 16, "i": 1 },
  { "input": 17, "output": 16, "i": 2 },
  { "input": 22, "output": 24, "i": 3 },
  { "input": 23, "output": 24, "i": 4 },
  { "input": 24, "output": 24, "i": 5 },
  { "input": 34, "output": 36, "i": 6 },
  { "input": 37, "output": 36, "i": 7 },
  { "input": 47, "output": 48, "i": 8 },
  { "input": 50, "output": 48, "i": 9 },
  { "input": 68, "output": 72, "i": 10 },
  { "input": 74, "output": 72, "i": 11 } ]

Keywords

FAQs

Package last updated on 06 Oct 2015

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