Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

How would I encode a RGBA to a Power BI Color?

I would like to store RGBA in SQL int columns to specify a fill color for a Charticulator Glyph (Shape).

 

If I encode my Red, Green, Blue, and Alpha columns as:

       (Alpha << 24) | (Red << 16) | (Green << 8 | Blue

 

The colors I am using are below:

 

 

When I set the Fill color for a Glyph to a SQL column containing the long value of the color, I get a gray scale:

 

 

My question is:

 

How are colors encoded for use in Power BI Charticulator visualizations?  

 

 

  • Hi Anonymous ,

     

    The code can use any color values listed in the CSS color spec at https://www.w3.org/TR/css-color-3/. These color values can include:

    • 3, 6 or 8-digit hex codes, for example #3E4AFF. Make sure you include the # symbol at the start of the code.
    • RGB or RGBA values, like RGBA(234, 234, 234, 0.5).
    • HSL or HSLA values, like HSLA(123, 75%, 75%, 0.5).
    • Color names, such as Green, SkyBlue, or PeachPuff.

    For, more detail you can refer this official article.

    Conditional table formatting in Power BI Desktop - Power BI | Microsoft Docs

     

    Best Regards

    Community Support Team _ chenwu zhu

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

3 Replies

  • Hi Anonymous ,

     

    In Power BI the colours are encoded in HEX code you need to use the HEX.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Would this be a string that contains the hexadecimal encode RGBA code?  I am currently using the Base 10 encode of RGBA.

     

           (Alpha << 24) | (Red << 16) | (Green << 8 | Blue

     

     

  • v-chenwuz-msft's avatar
    v-chenwuz-msft
    Community Support

    Hi Anonymous ,

     

    The code can use any color values listed in the CSS color spec at https://www.w3.org/TR/css-color-3/. These color values can include:

    • 3, 6 or 8-digit hex codes, for example #3E4AFF. Make sure you include the # symbol at the start of the code.
    • RGB or RGBA values, like RGBA(234, 234, 234, 0.5).
    • HSL or HSLA values, like HSLA(123, 75%, 75%, 0.5).
    • Color names, such as Green, SkyBlue, or PeachPuff.

    For, more detail you can refer this official article.

    Conditional table formatting in Power BI Desktop - Power BI | Microsoft Docs

     

    Best Regards

    Community Support Team _ chenwu zhu

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.