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
import chalk from 'chalk';
import { getMainColor, getFullName } from 'nba-color';
const warriors = 'GSW';
const { hex: warriorsColorHex } = getMainColor(warriors);
const warriorsFullName = getFullName(warriors);
console.log(chalk.bgHex(warriorsColorHex).bold(warriorsFullName));
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
import { getMainColor } from 'nba-color';
console.log(getMainColor('CLE'));
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
import { getSecondaryColor } from 'nba-color';
console.log(getSecondaryColor('NYK'));
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
import { getColors } from 'nba-color';
console.log(getColors('LAL'));
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
import { getColorsList } from 'nba-color';
console.log(getColorsList('LAL'));
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
import { getFullName } from 'nba-color';
console.log(getFullName('SAS'));
License
MIT © xxhomey19