# modular-scale

> Module for generating a modular scale.

Latest version **5.1.2** (published 2021-11-16) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install modular-scale
pnpm add modular-scale
yarn add modular-scale
bun add modular-scale
```

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 5.1.2 |
| Published | 2021-11-16 |
| First published | 2014-08-29 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | separate (@types/modular-scale) |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | @dam |
| Maintainers | dam |
| Keywords | modular, scale, typography, design, css |

## Links

- npm: https://www.npmjs.com/package/modular-scale
- Repository: https://github.com/kristoferjoseph/modular-scale
- Issues: https://github.com/kristoferjoseph/modular-scale/issues
- npm.io page: https://npm.io/package/modular-scale

## Alternatives

- [style-dictionary](https://npm.io/package/style-dictionary.md) — 2.0M weekly downloads
- [postcss-merge-idents](https://npm.io/package/postcss-merge-idents.md) — 1.7M weekly downloads
- [@fontsource/noto-sans](https://npm.io/package/@fontsource/noto-sans.md) — 93.0K weekly downloads
- [uglifycss](https://npm.io/package/uglifycss.md) — 71.6K weekly downloads
- [mat4-interpolate](https://npm.io/package/mat4-interpolate.md) — 23.3K weekly downloads

## Recent versions

- 5.1.2 (latest) — 2021-11-16
- 5.1.1 — 2021-11-16
- 5.1.0 — 2018-04-18
- 5.0.3 — 2018-04-18
- 5.0.2 — 2018-04-18
- 5.0.1 — 2018-04-18
- 4.4.1 — 2015-10-16
- 4.4.0 — 2015-10-16
- 4.3.0 — 2015-04-29
- 4.2.0 — 2015-04-29
- 4.1.0 — 2015-04-29
- 4.0.0 — 2015-04-29
- 3.0.0 — 2015-04-29
- 2.0.0 — 2015-04-28
- 1.0.0 — 2014-08-29

## README

modular-scale
=============

Module for generating a modular scale.


install
-------
`npm i modular-scale --save`

use
---

```js
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](http://www.modularscale.com)

---
_Source: https://npm.io/package/modular-scale · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
