NBA Color
Get all NBA team's color code (Hex or RGB).
Useful for building NBA-related colorful product.
Install
$ npm install nba-color
or
$ yarn add nba-color
Usage
;; const warriors = 'GSW';const hex: warriorsColorHex = ;const warriorsFullName = ; console;
result:
APIs
getAllColors()
=> Object
Return an Object
containing all NBA teams colors data.
The object's keys are uppercase Team Abbreviations.
getMainColor(teamAbbreviation)
=> Object
Parameter: String
It can be uppercase or lowercase Team Abbreviations.
Return: Object
Contain the NBA team main color's Hexadecimal Colors Code and RGB Color Code.
Note.
If received an excluded team abbreviation, return undefined
.
Example
; console; /*{ hex: '#6f263d', rgb: [111, 38, 61]}*/
getSecondaryColor(teamAbbreviation)
=> Object
Parameter: String
It can be uppercase or lowercase Team Abbreviations.
Return: Object
Contain the NBA team secondary color's Hexadecimal Colors Code and RGB Color Code.
Note.
If received an excluded team abbreviation, return undefined
.
Example
; console; /*{ hex: '#ff671f', rgb: [255, 103, 31],}*/
getColors(teamAbbreviation)
=> Object
Parameter: String
It can be uppercase or lowercase Team Abbreviations.
Return: Object
Contain the NBA team all colors, including Hexadecimal Colors Code and RGB Color Code for each color.
Note.
If received an excluded team abbreviation, return undefined
.
Example
; console; /*{ purple: { hex: '#702f8a', rgb: [112, 47, 138], }, gold: { hex: '#ffc72c', rgb: [255, 199, 44], }, white: { hex: '#ffffff', rgb: [255, 255, 255], }}*/
getColorsList(teamAbbreviation)
=> Array
Parameter: String
It can be uppercase or lowercase Team Abbreviations.
Return: Array
Contain the NBA team colors.
Note.
If received an excluded team abbreviation, return undefined
.
Example
; console; /*['purple', 'gold', 'white']*/
getFullName(teamAbbreviation)
=> String
Parameter: String
It can be uppercase or lowercase Team Abbreviations.
Return: String
The NBA team full name.
Note.
If received an excluded team abbreviation, return undefined
.
Example
; console; /*'San Antonio Spurs'*/
License
MIT © xxhomey19