Gutenberg CSS Always Uses Hex Value
-
I created a color with an alpha channel. I noticed that when I apply the color as a background to a Gutenberg block, the alpha isn’t used.
Looking at the code, I noticed that get_gutenberg_palette() always returns $set[‘hex’]. When I modify the code to return $set[‘color’] then the rgba value is used instead and the alpha is applied correctly. I was wondering if this is intentional behavior or a bug?
My environment:
Plugin version: 1.14.7
WP Version: 5.4.1
Theme: CustomSteps to reproduce:
1) Install plugin version 1.14.7
2) Enable plugin and configure as follows:
– Add to theme customizer: No
– Add to block editor: Yes
– Append to existing palette: Yes
– Enforce colors: No
– Add to classic editor: Yes
– Add global CSS variables to themes: No
– Add global CSS variables to the dashboard: No
3) Add a single color with value rgba(255,0,0,0.5)
4) Save
5) Open a page with Gutenberg
6) Select a block and open it’s color settings
7) Choose the transparent red color created on step 3
8) Save and visit the page
9) You will notice the block has the correct color but no alpha
The topic ‘Gutenberg CSS Always Uses Hex Value’ is closed to new replies.