1.0.1 ā€¢ Published 7 years ago

font-weight-from-name v1.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

font-weight-from-name

āš– Get the font weight number from common names

Usage

import fontWeight from 'font-weight-from-name'

console.log(fontWeight('semibold')) // > 600
console.log(fontWeight('demi bold')) // > 600
// non-alpha characters are tossed, and capitalization is ignored
console.log(fontWeight('dEMi__ --- bOLD?!šŸ˜‰')) // > 600

Currently supported names/weights

ā­ Remember, capitalization and spacing doesn't matter.

WeightNames
100hairline, thin
200extralight, ultralight
300light
400normal, regular
500medium
600demibold, semibold
700bold
800extrabold, ultrabold
900black, heavy

Did we miss something? Create an issue and let's get it added.

Install

With Yarn or npm installed, run:

yarn add font-weight-from-name

# ...or, if using `npm`
npm install font-weight-from-name

Acknowledgments

font-weight-from-name was inspired by dan-gamble/postcss-font-weight-names

License

MIT