Added a simple function to add color into an existing string #7

Merged
merged 1 commit into from Apr 13, 2012

Conversation

Projects
None yet
3 participants
Contributor

ollieparsley commented Apr 13, 2012

Added a simple function to add color into an existing string. Useful if the text is generated in another module etc. Has a try/catch block to trap invalid regex. Example:

var text = 'success: this is a string. But oh look! There is an Error: what are we going to do?';
text = color.replace(text, 'error:', 'red');
text = color.replace(text, 'success:', 'green');

+1

@loopj loopj added a commit that referenced this pull request Apr 13, 2012

@loopj loopj Merge pull request #7 from ollieparsley/master
Added a simple function to add color into an existing string
bf6fb1a

@loopj loopj merged commit bf6fb1a into loopj:master Apr 13, 2012

Owner

loopj commented Apr 13, 2012

Thanks Ollie!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment