Select to view content in your preferred language

Avatar - choose colour and 3 character ID display

675
3
07-11-2022 03:05 PM
Labels (1)
BenPitcairn
Emerging Contributor

Is there a way to set the background colour of an Avatar component?

Is it possible to display a three letter abreviation?

Tags (1)
0 Kudos
3 Replies
BenElan
Esri Contributor

Hi @BenPitcairn,

You can use avatar's thumbnail property to display an image. You can create the image in whatever color/letters/style you want! Here is an example:

https://codepen.io/benesri/pen/wvmWZBR

 

Note: Using an image with text is not accessible. The colors we use in avatar also consider contrast ratio guidelines.

0 Kudos
BenPitcairn
Emerging Contributor

Thanks for your response. I realise an image is possible but it is overkill for my needs and the images would have to be generated dynamically.
I was trying to use them as part of a legend for map features. What I need is a coloured marker that matches the feature on the map and a three letter abbreviation for the name of the feature. Which is very close to the Avatar compopnent.

I have got around this by using an SVG with a circle and text, placed inside a Chip component in the "image" slot.

0 Kudos
BenElan
Esri Contributor

FYI I did create an issue to allow setting the background color for Avatars, however we don't plan on allowing three letters. So as you mentioned SVG is your best bet.

0 Kudos