Incorrect assumption of hex input by ReaderThemeSupportFeatures::get_relative_luminance_from_hex()
#7285
Labels
Milestone
Bug Description
See support forum topic.
The
ReaderThemeSupportFeatures::get_relative_luminance_from_hex()
method incorrectly assumes hex input:amp-wp/src/ReaderThemeSupportFeatures.php
Lines 364 to 383 in a373ac8
It turns out that in some cases, a theme may be passing a CSS variable like
var(--base-2)
, or presumablyrgba(...)
could also be passed.To account for this, the
print_editor_color_palette_styles
method should skip passing the color value intoget_relative_luminance_from_hex
when it is not a valid hex.This could be achieved by adding:
After the following condition (or as part of it):
amp-wp/src/ReaderThemeSupportFeatures.php
Lines 281 to 286 in a373ac8
Expected Behaviour
If a non-hex color is used, no deprecated error should be raised from
hexdec()
here:amp-wp/src/ReaderThemeSupportFeatures.php
Lines 375 to 377 in a373ac8
Screenshots
No response
PHP Version
No response
Plugin Version
2.3.0
AMP plugin template mode
Reader
WordPress Version
No response
Site Health
No response
Gutenberg Version
No response
OS(s) Affected
No response
Browser(s) Affected
No response
Device(s) Affected
No response
Acceptance Criteria
No response
Implementation Brief
No response
QA Testing Instructions
No response
Demo
No response
Changelog Entry
No response
The text was updated successfully, but these errors were encountered: