The following code works but I am wondering if it can be improved both readability and performance.
I am using jquery and underscore.
Any suggestions, comments or feedbacks will be appreciate.
thanks.
var getThemeName = function (theme_name, transparency) {
if (theme_name === 'light') {
if (transparency) {
return translator.get('messages:theme.info.light_with_transparency', {
percentage: transparency
});
}
return translator.get('messages:theme.info.light');
} else if (theme_name === 'dark') {
if (transparency) {
return translator.get('messages:theme.info.dark_with_transparency', {
percentage: transparency
});
}
return translator.get('messages:theme.info.dark');
}
};
var THEME_ITEMS = {
themeLight: getThemeName('light'),
themeLightTransparency75: getThemeName('light', 75),
themeLightTransparency50: getThemeName('light', 50),
themeLightTransparency25: getThemeName('light', 25),
themeDark: getThemeName('dark'),
themeDarkTransparency75: getThemeName('dark', 75),
themeDarkTransparency50: getThemeName('dark', 50),
themeDarkTransparency25: getThemeName('dark', 25)
};