0.0.7 • Published 7 years ago
ember-hex-string v0.0.7
Ember-hex-string
Simple one way idempotent conversion from a string to a hex value. Useful for generating unique colors for a supplied string.
Installation
In an ember app
ember i ember-hex-string
To clone this library
git clonethis repositorynpm ibower i
QuickStart
stringToHex
stringToHex will convert a givin string to a hex value.
Import the utility at the top of your file
// app/components/my-random.js
import { stringToHex } from 'ember-hex-string/utils/conversions';Pass the utility any string value
let initials = 'ET';
stringToHex('ET'); // ==> '8af';stringToHexColor
stringToHexColor will convert a givin string to a hex value, and safely truncate it to a 3 or 6 character length. Useful for conversion to a unique CSS color.
Import the utility at the top of your file
// app/components/my-random.js
import { stringToHexColor } from 'ember-hex-string/utils/conversions';Pass the utility any string value
let initials = 'ET';
stringToHexColor('www.google.com'); // ==> '#29e53e';Running Tests
npm test(Runsember try:testallto test your addon against multiple Ember versions)ember testember test -s
Building
ember build
For more information on using ember-cli, visit http://ember-cli.com/.