1.0.0 • Published 9 years ago

translate-font-weight v1.0.0

Weekly downloads
17
License
MIT
Repository
github
Last release
9 years ago

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.

namesvalue
Thin100
Extra-light, Ultra-light200
Light300
Normal, Regular, Roman, Book400
Medium500
Semi-bold, Demi-bold600
Bold700
Extra-bold, Ultra-bold800
Black, Heavy900

License

MIT