开发者社区> 镜像站> NPM> font-weight-from-name
font-weight-from-name
> ⚖ Get the font weight number from common names
Last updated 3 years ago by blakek .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install font-weight-from-name 
SYNC missed versions from official npm registry.

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.

Weight Names
100 hairline, thin
200 extralight, ultralight
300 light
400 normal, regular
500 medium
600 demibold, semibold
700 bold
800 extrabold, ultrabold
900 black, 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

Current Tags

  • 1.0.1                                ...           latest (3 years ago)

2 Versions

  • 1.0.1                                ...           3 years ago
  • 1.0.0                                ...           3 years ago
Downloads
Today 0
This Week 1
This Month 1
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (5)
Dependents (0)
None