translate-font-weight

1.0.0 • Public • Published

translate-font-weight

A tiny module that translates font-weight names into appropriate integer values.

Build status

Install

$ npm install translate-font-weight

Usage

var translate = require('translate-font-weight')
 
var heading = document.querySelector('h1')
var weight = getComputedStyle(heading).fontWeight
 
console.log(translate(weight))
> 700

API

The following is a list of font weight names and their translated values. All names are case-insensitive, and their hyphens are optional.

names value
Thin 100
Extra-light, Ultra-light 200
Light 300
Normal, Regular, Roman, Book 400
Medium 500
Semi-bold, Demi-bold 600
Bold 700
Extra-bold, Ultra-bold 800
Black, Heavy 900

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i translate-font-weight

Weekly Downloads

2

Version

1.0.0

License

MIT

Last publish

Collaborators

  • michaelrhodes