1.0.0 • Published 4 years ago

star-colors v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

star-colors

Build Status npm version

Get realistic colors of stars in rgb or hex. Datas come from Mitchell Charity's.

Install

npm install --save star-colors

Usage

const starColors = require('star-colors');

const O5V = starColors.get('O5V');
// O5V
// {
//   "class": "O5V",
//   "r": "155",
//   "g": "176",
//   "b": "255",
//   "hex": "#9bb0ff"
// }

Or in Html:

<script src="/path/to/star-colors.min.js"></script>

API

get (type)

Return the entire data object of a specific stellar class. Including the following properities: class, r, g, b, hex.

randomRgb ()

Return a random color in rgb code from data.

randomHex ()

Return a random color in hex code from data.