Skip to content

Generate a random color from a given string, very useful for displaying status, months of the year, days of the week, or any text based grouping. Uses Math and random salts to build RGB values.

Notifications You must be signed in to change notification settings

eknowles/color-this

Repository files navigation

color-this

npm Travis branch Coveralls github branch GitHub stars GitHub issues semantic-release

Generate a random color from a given string

Add color to graph series names, months of the year, days of the week, super useful to add a unique subtle differentiator.

Demos

Getting Started

Load from npm

# NPM
npm i @eknowles/color-this

# Yarn
yarn add @eknowles/color-this

Now import and use in React, Node or wherever!

import React from 'react';
import ct from '@eknowles/color-this';

export const MyLabelComponent = ({text}) => (
  <div style={{background: ct(text)}}>{text}</div>
);

Frameworks

AngularJS - http://eknowles.github.io/angular-color-this/

About

Generate a random color from a given string, very useful for displaying status, months of the year, days of the week, or any text based grouping. Uses Math and random salts to build RGB values.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published