TransWikia.com

Setting transparency color in Expression Builder

Geographic Information Systems Asked by necrohiero on January 23, 2021

Using QGIS 3.16, I am trying to set color through expression builder, using #RRGGBBAA format.

The problem, I was using the same color, let’s say '#94AFDCff', it should return the same color as '#94AFDC' in #RRGGBB format, yet the color that is rendered is fully different. I cannot seem to find out why.
Could anyone help?

The code is simple, it is used in symbol, as a condition of fill colors of circles.

CASE
    WHEN   "Cat_Num" = 1 THEN '#94AFDC66'
    WHEN  "Cat_Num"  = 2 THEN '#FFFF0066'
    WHEN  "Cat_Num"  =  3 THEN '#ffc40366'
    WHEN  "Cat_Num"  =  4 THEN '#54823566'
    WHEN  "Cat_Num"  =  5 THEN '#7030a066'
    WHEN  "Cat_Num"  =  6 THEN '#843c0c66'
    WHEN  "Cat_Num"  =  7 THEN '#38c0f666'
    WHEN  "Cat_Num"  =  8 THEN '#CCCC0066'
    WHEN  "Cat_Num"  =  9 THEN '#C55A1166'
    WHEN  "Cat_Num"  =  10 THEN '#8d5a9966'
    ELSE 'pink'
END

but this code resulted in (notice that the 2 circles are "Cat_Num" = 8 THEN '#CCCC0066' and "Cat_Num" = 10 THEN '#8d5a9966')

result picture

In the end, I did change the code to rgba format, so that "Cat_Num" = 8 THEN '204, 204, 0, 90' and "Cat_Num" = 10 THEN '141, 90, 153, 90'
with this result:

result

How are these 2 so different?? The hex color returns pink result for "Cat_Num" = 8 THEN '#CCCC0066' (the bigger circle). The smaller circle, which should return purplish, became greenish… Did I make a mistake?

As a reference, in QGIS’ own color picker, inputting '#CCCC0066' will have the same color as '141, 90, 153, 90', only different transparency value (90 is about 0.65% for RRGGBBAA and 66 in hex is 40% )

Color Picker

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP