From 850e81e9508d56ec30a0c75b30c62013020139f8 Mon Sep 17 00:00:00 2001 From: Aleksandr Borisenko Date: Sat, 9 Jun 2018 08:41:19 +0300 Subject: [PATCH 1/3] Fixed white on white issue when header background is RBG color --- js/app/directives/use-theme.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/js/app/directives/use-theme.js b/js/app/directives/use-theme.js index 8544cfadc..7f8624caa 100644 --- a/js/app/directives/use-theme.js +++ b/js/app/directives/use-theme.js @@ -42,6 +42,16 @@ return color; } + function whenRgbToHex(input) { + var re = /rgb\((\d+),\s*(\d+),\s*(\d+)\)/i; + var match = input.match(re); + if (match) { + var rgb = match[1] | (match[2] << 8) | (match[3] << 16); + return '#' + (0x1000000 + rgb).toString(16).slice(1); + } + return input; + } + return { restrict: 'A', scope: { @@ -50,7 +60,8 @@ negative: '=' }, link: function (scope, el) { - var _color = jQuery('#header').css('background-color'); + var _color = whenRgbToHex( + jQuery('#header').css('background-color')); var _bg = _color; if (scope.negative) { _bg = invertColor(_bg); @@ -66,4 +77,4 @@ } }; }]); -}()); \ No newline at end of file +}()); From 52526a0c7a9aecc1d5268412a46e09393dada350 Mon Sep 17 00:00:00 2001 From: Aleksandr Borisenko Date: Sat, 9 Jun 2018 09:05:17 +0300 Subject: [PATCH 2/3] Removed redundant code --- js/app/directives/use-theme.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/app/directives/use-theme.js b/js/app/directives/use-theme.js index 7f8624caa..34c4381f2 100644 --- a/js/app/directives/use-theme.js +++ b/js/app/directives/use-theme.js @@ -46,8 +46,8 @@ var re = /rgb\((\d+),\s*(\d+),\s*(\d+)\)/i; var match = input.match(re); if (match) { - var rgb = match[1] | (match[2] << 8) | (match[3] << 16); - return '#' + (0x1000000 + rgb).toString(16).slice(1); + var color = match[1] | (match[2] << 8) | (match[3] << 16); + return '#' + color.toString(16); } return input; } From 731e570a5bf2336e86919600f8f086d9fbe30c9a Mon Sep 17 00:00:00 2001 From: Aleksandr Borisenko Date: Sat, 9 Jun 2018 09:19:26 +0300 Subject: [PATCH 3/3] Fixed the previous fix --- js/app/directives/use-theme.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/app/directives/use-theme.js b/js/app/directives/use-theme.js index 34c4381f2..92e8d3ec3 100644 --- a/js/app/directives/use-theme.js +++ b/js/app/directives/use-theme.js @@ -47,7 +47,7 @@ var match = input.match(re); if (match) { var color = match[1] | (match[2] << 8) | (match[3] << 16); - return '#' + color.toString(16); + return '#' + (0x1000000 + color).toString(16).slice(1); } return input; }