mirror of
				https://github.com/flynx/colors.js.git
				synced 2025-10-31 20:10:09 +00:00 
			
		
		
		
	[api] Added ability to set styles via array. Closes #27
This commit is contained in:
		
							parent
							
								
									52d4f71696
								
							
						
					
					
						commit
						b91a1eccf3
					
				
							
								
								
									
										14
									
								
								colors.js
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								colors.js
									
									
									
									
									
								
							| @ -121,11 +121,23 @@ function applyTheme(theme) { | |||||||
|   Object.keys(theme).forEach(function (prop) { |   Object.keys(theme).forEach(function (prop) { | ||||||
|     if (stringPrototypeBlacklist.indexOf(prop) !== -1) { |     if (stringPrototypeBlacklist.indexOf(prop) !== -1) { | ||||||
|       console.log('warn: '.red + ('String.prototype' + prop).magenta + ' is probably something you don\'t want to override. Ignoring style name'); |       console.log('warn: '.red + ('String.prototype' + prop).magenta + ' is probably something you don\'t want to override. Ignoring style name'); | ||||||
|     } else { |     } | ||||||
|  |     else { | ||||||
|  |       if (typeof(theme[prop]) === 'string') { | ||||||
|         addProperty(prop, function () { |         addProperty(prop, function () { | ||||||
|             return exports[theme[prop]](this); |             return exports[theme[prop]](this); | ||||||
|         }); |         }); | ||||||
|       } |       } | ||||||
|  |       else { | ||||||
|  |         addProperty(prop, function () { | ||||||
|  |           var ret = this; | ||||||
|  |           for (var t = 0; t < theme[prop].length; t++) { | ||||||
|  |               ret = exports[theme[prop][t]](ret); | ||||||
|  |           } | ||||||
|  |           return ret; | ||||||
|  |         }); | ||||||
|  |       } | ||||||
|  |     } | ||||||
|   }); |   }); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user