🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

accoutrement-scale

Package Overview
Dependencies
Maintainers
2
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

accoutrement-scale

Size and scale helpers for typography and layout.

6.0.0
latest
Source
npm
Version published
Weekly downloads
9
12.5%
Maintainers
2
Weekly downloads
 
Created
Source

accoutrement-scale

Sass size & scale management tools by OddBird. Gather all your sizes into a single map, generate new sizes based on modular scales or arbitrary functions, and access them by name.

More Accoutrement Tools

  • Init provides light-weight browser-normalization.
  • Color provides color-palette management and contrast-ratio utilities.
  • Type provides webfont management tools, and other typography helpers.
  • Layout provides layout utilities such as box-sizing, intrinsic ratios, z-index management, named media-queries, and a clearfix.

Quick Start

Install the package with npm or yarn:

npm install accoutrement-scale
yarn add accoutrement-scale

Import the library:

@import '<path-to>/accoutrement-scale/sass/scale';

Establish your palette of ratios (modular scales) and sizes:

$ratios: (
  'my-ratio': 1.25,
);

$sizes: (
  // define explicit values
  'root': 24px,
  'icons': 1em,
  'page': 8in,

  // reference existing sizes
  'text': 'root'

  // apply adjustments and conversions
  // using named-ratios or arbitrary functions
  'rhythm': 'root' ('fifth': 1, 'convert-units': 'rem'),

  'h1': 'root' ('my-ratio': 3),
  'h2': 'root' ('my-ratio': 2),
  'h3': 'root' ('my-ratio': 1),

  // define calc() output based on existing sizes
  'viewport-relative': calc(%s + %s) ('root', 2vw),
);

Access your named sizes using the size() function, and even convert-units on-the-fly:

.example {
  font-size('text');
  width: size('page', 'px');
}

We can only calculate integer steps along an exponential modular scale, but if you want more power, install MathSass, and we'll let them do the hard math.

$sizes: (
  'complex': 'root' ('my-scale': 1.25),
);

Keywords

sass

FAQs

Package last updated on 03 Apr 2018

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