• 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: Custom

    Steps 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

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Daniel Men?ies

    (@kungtiger)

    It’s not a bug it’s a feature. As far as I know WordPress’ block editor does not offer an UI to change/set an alpha channel. Hence my plugin always passes its colours as #RRGGBB.

    Thread Starter tgruwell

    (@tgruwell)

    Thanks Daniel. That makes sense.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Gutenberg CSS Always Uses Hex Value’ is closed to new replies.