diff --git a/demo/index.html b/demo/index.html index b0975352..d1818a2b 100644 --- a/demo/index.html +++ b/demo/index.html @@ -16,7 +16,7 @@

- +

diff --git a/js/notify/assets/symphony-logo-black.png b/js/notify/assets/symphony-logo-black.png new file mode 100644 index 00000000..8ba73198 Binary files /dev/null and b/js/notify/assets/symphony-logo-black.png differ diff --git a/js/notify/assets/symphony-logo-white.png b/js/notify/assets/symphony-logo-white.png new file mode 100644 index 00000000..1a484192 Binary files /dev/null and b/js/notify/assets/symphony-logo-white.png differ diff --git a/js/notify/electron-notify-preload.js b/js/notify/electron-notify-preload.js index afdca896..589385f9 100644 --- a/js/notify/electron-notify-preload.js +++ b/js/notify/electron-notify-preload.js @@ -9,6 +9,8 @@ const electron = require('electron'); const ipc = electron.ipcRenderer; +const whiteColorRegExp = new RegExp(/^(?:white|#fff(?:fff)?|rgba?\(\s*255\s*,\s*255\s*,\s*255\s*(?:,\s*1\s*)?\))$/i); + /** * Sets style for a notification * @param config @@ -19,7 +21,9 @@ function setStyle(config) { let container = notiDoc.getElementById('container'); let header = notiDoc.getElementById('header'); let image = notiDoc.getElementById('image'); + let logo = notiDoc.getElementById('symphony-logo'); let title = notiDoc.getElementById('title'); + let pod = notiDoc.getElementById('pod'); let message = notiDoc.getElementById('message'); let close = notiDoc.getElementById('close'); @@ -37,8 +41,12 @@ function setStyle(config) { setStyleOnDomElement(config.defaultStyleImage, image); + setStyleOnDomElement(config.defaultStyleLogo, logo); + setStyleOnDomElement(config.defaultStyleTitle, title); + setStyleOnDomElement(config.defaultStylePod, pod); + setStyleOnDomElement(config.defaultStyleText, message); setStyleOnDomElement(config.defaultStyleClose, close); @@ -75,6 +83,20 @@ function setContents(event, notificationObj) { if (notificationObj.color) { container.style.backgroundColor = notificationObj.color; + let logo = notiDoc.getElementById('symphony-logo'); + + if (notificationObj.color.match(whiteColorRegExp)) { + logo.src = './assets/symphony-logo-black.png'; + } else { + let title = notiDoc.getElementById('title'); + let pod = notiDoc.getElementById('pod'); + let message = notiDoc.getElementById('message'); + + message.style.color = '#ffffff'; + title.style.color = '#ffffff'; + pod.style.color = notificationObj.color; + logo.src = './assets/symphony-logo-white.png'; + } } if (notificationObj.flash) { diff --git a/js/notify/electron-notify.html b/js/notify/electron-notify.html index 05243059..ec8c2c2b 100644 --- a/js/notify/electron-notify.html +++ b/js/notify/electron-notify.html @@ -2,11 +2,17 @@

-