Warning in color management code

Created on 24 August 2023, almost 2 years ago
Updated 23 September 2023, almost 2 years ago

Problem/Motivation

The newly introduced color management code in bootstrap_barrio.theme has some problem which produces warning when color schema is enabled.

Steps to reproduce

Enable the latest version of bootstrap_barrio theme(5.5.13 or 5.5.x) or its subtheme, in the theme settings page, check "Enable color Sheme" in section "Barrio Color Scheme Settings", then go to any page using this theme, the following two warning will be produced in watchdog(or displayed on page if warnings are display on page in "Logging and errors" settings):

1. Converting float to int:

Deprecated function: Implicit conversion from float 34.85 to int loses precision in _color_luminance() (line 893 of themes/contrib/bootstrap_barrio/bootstrap_barrio.theme).

_color_luminance('29485d', -0.15) (Line: 35)
bootstrap_barrio_preprocess_html(Array, 'html', Array)

2. Using undefined variable $bc

Warning: Undefined variable $bc in bootstrap_barrio_preprocess_html() (line 36 of themes/contrib/bootstrap_barrio/bootstrap_barrio.theme).

bootstrap_barrio_preprocess_html(Array, 'html', Array)
call_user_func_array('bootstrap_barrio_preprocess_html', Array) (Line: 285)

Proposed resolution

For issue 1, convert float into integer explicitly.
For issue 2, $bc should be defined.

Remaining tasks

none

User interface changes

none

API changes

none

Data model changes

none

🐛 Bug report
Status

Fixed

Version

5.5

Component

Code

Created by

🇩🇪Germany qichanghai Munich

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024