[IMP] website: allow to have reference SCSS variables for color pickers

This commit allows the color picker widget to manage an SCSS variable
which can itself be a reference to another SCSS variable.

task-2904507

Part-of: odoo/odoo#99732
This commit is contained in:
Guillaume (gdi)
2023-10-12 08:09:26 +00:00
committed by qsm-odoo
parent 42084242f8
commit 85befe55ba
@@ -719,7 +719,16 @@ options.Class.include({
case 'customizeWebsiteVariable': {
const ownerDocument = this.$target[0].ownerDocument;
const style = ownerDocument.defaultView.getComputedStyle(ownerDocument.documentElement);
return weUtils.getCSSVariableValue(params.variable, style);
let finalValue = weUtils.getCSSVariableValue(params.variable, style);
if (!params.colorNames) {
return finalValue;
}
let tempValue = finalValue;
while (tempValue) {
finalValue = tempValue;
tempValue = weUtils.getCSSVariableValue(tempValue.replaceAll("'", ''), style);
}
return finalValue;
}
case 'customizeWebsiteColor': {
const ownerDocument = this.$target[0].ownerDocument;