diff --git a/source/Ox.UI/Ox.UI.js b/source/Ox.UI/Ox.UI.js index 4f52355f..1d6f76ba 100644 --- a/source/Ox.UI/Ox.UI.js +++ b/source/Ox.UI/Ox.UI.js @@ -258,6 +258,7 @@ Ox.load.UI = function(options, callback) { function initUI() { + //@ Ox.UI Object with various UI properties and methods Ox.UI = {}; Ox.UI.ready = (function() { @@ -299,13 +300,28 @@ Ox.load.UI = function(options, callback) { Ox.UI.getImageName = function(url) { return imageNames[url]; }; - Ox.UI.getImageURL = function(name, theme) { + /*@ + getImageURL Returns an image URL + (name[, theme[, color]]) -> Image URL + Setting color works only when the `loadImages` option is set to + `true`. + @*/ + Ox.UI.getImageURL = function(name, theme, color) { + var imageURL; theme = theme || Ox.Theme(); // fixme: not the best idea to do this here if (name == 'symbolPlay') { name = 'symbolRight'; } - return imageURLs[theme + '/' + name]; + imageURL = imageURLs[theme + '/' + name]; + if (options.loadImages && color) { + imageURL = 'data:image/svg+xml;base64,' + btoa( + atob(imageURL.split(',')[1]).replace( + /#\d{6}/, '#' + Ox.toHex(Ox.Theme[theme].color[color] + )) + ); + } + return imageURL; }; Ox.UI.getVideoFormat = function(formats) { var aliases = {