From 536864589dd71ae74063a9188b69d548b8484010 Mon Sep 17 00:00:00 2001 From: Andras Timar Date: Sat, 26 Oct 2024 21:13:01 +0200 Subject: [PATCH] skip css variable if not set (prevent warning on COOL side) Signed-off-by: Andras Timar --- src/helpers/coolParameters.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/helpers/coolParameters.js b/src/helpers/coolParameters.js index 3d73ed5429..790eecb846 100644 --- a/src/helpers/coolParameters.js +++ b/src/helpers/coolParameters.js @@ -145,8 +145,8 @@ const generateCSSVarTokens = () => { const lightStyle = window.getComputedStyle(lightElement).getPropertyValue(varName) const darkStyle = window.getComputedStyle(darkElement).getPropertyValue(varName) - str += varName.replace('--', '--nc-light-') + '=' + lightStyle.trim() + ';' - str += varName.replace('--', '--nc-dark-') + '=' + darkStyle.trim() + ';' + if (lightStyle) str += varName.replace('--', '--nc-light-') + '=' + lightStyle.trim() + ';' + if (darkStyle) str += varName.replace('--', '--nc-dark-') + '=' + darkStyle.trim() + ';' // Workaround for now as we need primary-invert-if-dark which is not available on server yet if (varName === '--primary-invert-if-bright') {