Fix: Replace deprecated getBrightness with new method

New method created in is_themecore module: Uses use PrestaShop\PrestaShop\Core\Util\ColorBrightnessCalculator and adds as smarty function in SmartyHelperFunctions.php
This commit is contained in:
2025-11-19 17:14:56 +01:00
parent 6849b8eefd
commit ae299283a7
4 changed files with 4 additions and 4 deletions

View File

@ -75,7 +75,7 @@
type="{if $facet.multipleSelectionAllowed}checkbox{else}radio{/if}" class="custom-control-input"
{if $filter.active } checked{/if}>
<label for="facet_input_{$_expand_id}_{$filter_key}" {if isset($filter.properties.color)}
class="custom-control-label custom-control-label-{if Tools::getBrightness($filter.properties.color) > 128}dark{else}bright{/if}"
class="custom-control-label custom-control-label-{if $filter.properties.color|is_bright}dark{else}bright{/if}"
{else} class="custom-control-label"
{/if}>
{if isset($filter.properties.color)}

View File

@ -45,7 +45,7 @@
<div class="custom-control custom-radio-color">
<input class="custom-control-input" type="radio" data-product-attribute="{$id_attribute_group}" id="{$id_attribute_group}_{$id_attribute}" name="group[{$id_attribute_group}]" value="{$id_attribute}" title="{$group_attribute.name}"{if $group_attribute.selected} checked="checked"{/if}>
<label class="custom-control-label {if $group_attribute.html_color_code}custom-control-label-{if Tools::getBrightness($group_attribute.html_color_code) > 128}dark{else}bright{/if}{/if}" for="{$id_attribute_group}_{$id_attribute}" aria-label="{$group_attribute.name}">
<label class="custom-control-label {if $group_attribute.html_color_code}custom-control-label-{if $group_attribute.html_color_code|is_bright}dark{else}bright{/if}{/if}" for="{$id_attribute_group}_{$id_attribute}" aria-label="{$group_attribute.name}">
<span
{if $group_attribute.texture}
class="custom-control-input-color" style="background-image: url({$group_attribute.texture})"

View File

@ -60,7 +60,7 @@
<td class="hidden-md-down align-middle">{$order.details.payment}</td>
<td class="align-middle">
<span
class="label label-pill badge {if Tools::getBrightness($order.history.current.color) < 128}text-white{/if}"
class="label label-pill badge {if !$order.history.current.color|is_bright}text-white{/if}"
style="background-color:{$order.history.current.color}"
>
{$order.history.current.ostate_name}

View File

@ -89,7 +89,7 @@
<td>{$state.history_date}</td>
<td>
<span
class="label label-pill badge {if Tools::getBrightness($state.color) < 128}text-white{/if}"
class="label label-pill badge {if !$state.color|is_bright}text-white{/if}"
style="background-color:{$state.color}">
{$state.ostate_name}
</span>