1.0.0 • Published 11 years ago
translate-font-weight v1.0.0
translate-font-weight
A tiny module that translates font-weight names into appropriate integer values.
Install
$ npm install translate-font-weightUsage
var translate = require('translate-font-weight')
var heading = document.querySelector('h1')
var weight = getComputedStyle(heading).fontWeight
console.log(translate(weight))
> 700API
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
1.0.0
11 years ago