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