New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More

nba-color

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nba-color

Get NBA team's color.


Version published
Weekly downloads
9
decreased by-10%
Maintainers
1
Weekly downloads
 
Created

NBA Color

Get all NBA team's color code (Hex or RGB).
Useful for building NBA-related colorful product.

Build Status Coverage Status

screen shot 2017-10-27 at 9 33 07 pm

Install

$ npm install nba-color

Usage

const chalk = require('chalk');
const { getMainColor, getFullName } = require('nba-color');

const warriors = 'GSW';
const { hex: warriorsColorHex } = getMainColor(warriors);
const warriorsFullName = getFullName(warriors);

console.log(chalk.bgHex(warriorsColorHex).bold(warriorsFullName));

result: screen shot 2017-10-28

API

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 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

const { getMainColor } = require('nba-color');

console.log(getMainColor('CLE'));

/*
{
  hex: '#6f263d',
  rgb: [111, 38, 61]
}
*/

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

const { getColors } = require('nba-color');

console.log(getColors('LAL'));

/*
{
  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

const { getColorsList } = require('nba-color');

console.log(getColorsList('LAL'));

/*
['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

const { getFullName } = require('nba-color');

console.log(getFullName('SAS'));

/*
'San Antonio Spurs'
*/

License

MIT

FAQs

Package last updated on 22 Nov 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts