mirror of
				https://github.com/flynx/colors.js.git
				synced 2025-10-31 12:00:08 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			15 lines
		
	
	
		
			345 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			15 lines
		
	
	
		
			345 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| var colors = require('../colors');
 | |
| 
 | |
| module['exports'] = (function() {
 | |
|   // RoY G BiV
 | |
|   var rainbowColors = ['red', 'yellow', 'green', 'blue', 'magenta'];
 | |
|   return function(letter, i, exploded) {
 | |
|     if (letter === ' ') {
 | |
|       return letter;
 | |
|     } else {
 | |
|       return colors[rainbowColors[i++ % rainbowColors.length]](letter);
 | |
|     }
 | |
|   };
 | |
| })();
 | |
| 
 |