Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[api] Added ability to set styles via array. Closes #27

  • Loading branch information...
commit b91a1eccf3152f8eff21b8919b5fdf011fdd059d 1 parent 52d4f71
@stelcheck stelcheck authored committed
Showing with 16 additions and 4 deletions.
  1. +16 −4 colors.js
View
20 colors.js
@@ -121,10 +121,22 @@ function applyTheme(theme) {
Object.keys(theme).forEach(function (prop) {
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');
- } else {
- addProperty(prop, function () {
- return exports[theme[prop]](this);
- });
+ }
+ else {
+ if (typeof(theme[prop]) === 'string') {
+ addProperty(prop, function () {
+ 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;
+ });
+ }
}
});
}
Please sign in to comment.
Something went wrong with that request. Please try again.