Home

Awesome

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.