make themeColors global

This commit is contained in:
Yaman Qalieh 2016-08-29 20:39:36 -04:00
parent 81ebc744d8
commit ef2afa13e8

View File

@ -11,34 +11,6 @@ var openValues = {
"options": "-20%" "options": "-20%"
}; };
Session.set('themeColors', {
"light": {
"background": "White.jpg",
"header": "#EBEBEB",
"sidebar": "#65839A",
"funcButton": "#849CAE",
"statusIcons": "#33ADFF",
"highlightText": "#FF1A1A",
"cards": "#FEFEFE",
"classes":"#EBEBEB",
"calendar": "#000",
"text": "#000"
},
"dark": {
"background": "Black.jpg",
"header": "#373A56",
"sidebar": "#35435D",
"funcButton": "#5d75A2",
"statusIcons": "#33ADFF",
"highlightText": "#FF1A1A",
"cards": "#151A2B",
"classes":"#46396E",
"calendar": "#000",
//30313B
"text": "#F6F6F6"
}
});
var workColors = { var workColors = {
"normal": "#2E4F74", "normal": "#2E4F74",
"quiz": "#409333", "quiz": "#409333",
@ -80,11 +52,11 @@ Session.set("classDispHover",null);
Session.set("commentRestrict",null); Session.set("commentRestrict",null);
Template.registerHelper('divColor', (div) => { // Reactive color changing based on preferences. Colors stored in Session.get("themeColors"). Template.registerHelper('divColor', (div) => { // Reactive color changing based on preferences. Colors stored in Session.get("themeColors").
return Session.get("themeColors")[Meteor.user().profile.preferences.theme][div]; return themeColors[Meteor.user().profile.preferences.theme][div];
}); });
Template.registerHelper('textColor', () => { // Reactive color for text. Template.registerHelper('textColor', () => { // Reactive color for text.
document.getElementsByTagName("body")[0].style.color = Session.get("themeColors")[Meteor.user().profile.preferences.theme].text; document.getElementsByTagName("body")[0].style.color = themeColors[Meteor.user().profile.preferences.theme].text;
return; return;
}); });
@ -93,7 +65,7 @@ Template.registerHelper('overlayDim', (part) => { // Gets size of the overlay co
var width = "width:" + dim[0].toString() + "px;"; var width = "width:" + dim[0].toString() + "px;";
var height = "height:" + dim[1].toString() + "px;"; var height = "height:" + dim[1].toString() + "px;";
var margin = "margin-left:" + (-dim[0] / 2).toString() + "px;"; var margin = "margin-left:" + (-dim[0] / 2).toString() + "px;";
var bg = "background-color:" + Session.get("themeColors")[Meteor.user().profile.preferences.theme].header + ";"; var bg = "background-color:" + themeColors[Meteor.user().profile.preferences.theme].header + ";";
return width + height + margin + bg; return width + height + margin + bg;
}); });
@ -198,9 +170,9 @@ Template.main.helpers({
}, },
iconColor(icon) { iconColor(icon) {
if (Session.get("sidebar") === icon + "Container") { if (Session.get("sidebar") === icon + "Container") {
return Session.get("themeColors")[Meteor.user().profile.preferences.theme].statusIcons; return themeColors[Meteor.user().profile.preferences.theme].statusIcons;
} else if (Session.get("sidebar") === "both") { } else if (Session.get("sidebar") === "both") {
return Session.get("themeColors")[Meteor.user().profile.preferences.theme].statusIcons; return themeColors[Meteor.user().profile.preferences.theme].statusIcons;
} else { } else {
return; return;
} }
@ -214,7 +186,7 @@ Template.main.helpers({
}, },
bgSrc() { bgSrc() {
var dim = [window.innerWidth, window.innerHeight]; var dim = [window.innerWidth, window.innerHeight];
var pic = "Backgrounds/"+Session.get("themeColors")[Meteor.user().profile.preferences.theme].background; var pic = "Backgrounds/"+themeColors[Meteor.user().profile.preferences.theme].background;
return pic; return pic;
}, },
menuStatus() { menuStatus() {
@ -237,7 +209,7 @@ Template.main.helpers({
}, },
modeStatus(status) { modeStatus(status) {
if (status === Session.get("mode")) { if (status === Session.get("mode")) {
return Session.get("themeColors")[Meteor.user().profile.preferences.theme].highlightText; return themeColors[Meteor.user().profile.preferences.theme].highlightText;
} else { } else {
return; return;
} }
@ -333,7 +305,7 @@ Template.main.helpers({
return "width:" + width.toString() + "px;margin-left:" + (0.5 * window.innerWidth - 0.5 * width).toString() + "px;"; return "width:" + width.toString() + "px;margin-left:" + (0.5 * window.innerWidth - 0.5 * width).toString() + "px;";
}, },
calColor() { calColor() {
return "color:"+Session.get("themeColors")[Meteor.user().profile.preferences.theme].calendar; return "color:"+themeColors[Meteor.user().profile.preferences.theme].calendar;
}, },
calbg() { calbg() {
var width = window.innerWidth * 0.865; var width = window.innerWidth * 0.865;