rbga token does not work

Created on 10 April 2021, about 3 years ago
Updated 8 January 2024, 6 months ago

Problem/Motivation

As far as I can see the rgba token does not work.

[color_field:rgb:rgba];

Steps to reproduce

1. Switch to advanced mode when configuring the field display

2. Create a declaration with tokens. For example;

.paragraph--id--99 {
box-shadow: inset 0 0 0 100vmax [color_field:rgb:rgba];
}

3. Inspect the element and it will look exactly the same as the declaration.

I would have expected something like this;

.paragraph--id--99 {
box-shadow: inset 0 0 0 100vmax rbga(100,100,100,0.5);
}

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Needs review

Version

2.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom MrPaulDriver

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States bburg Washington D.C.

    @NickDickinsonWilde

    This token isn't working for me either. I can't enter "[color_field:rgba]" in the CSS Declaration config, because it fails validation due to not being a valid token. Even though "[color_field:rgb:rgba]" is what appears in the token information pop up.

    I tried just modifying the color_field_tokens() function in color_field.module, and changed:

            case 'rgba':
    

    to

            case 'rgb:rgba':
    

    I assume this is because the token is defined like this in color_field_token_info():

      $tokens['rgb']['rgba'] = [
    

    As that seemed to be the pattern that multi-part tokens like this followed, and that worked for me.

    I am using
    Drupal core: 10.1.7
    Color Field 3.0.0

    I'm uploading a patch that applies a similar fix. Instead of replacing the case value entirely, I'm just adding a redundant one for "rgb:rgba" in case anyone previously entered the "[color_field:rgba]" value in fields whose tokens aren't validated.

Production build 0.69.0 2024