Custom icons and ignore status

Luc VDN a year ago

Hi,

I've created a list of SVG :
van_RED.SVG
van_PURPLE.svg
van_BLUE.svg

I put my SVG in src/resources/images/icon/
I changed src/map/core/preloadImages.js

My icons are OK on traccar, but they don't have their color :(
Their color are changed by status color (grey, black and green) and my color are ignored :'(

Who know what must I change to ignore status color (grey, black and green) and keep the color defined in the SVG ?

Thank you

Anton Tananaev a year ago

You probably have to change the code that loads those icons.

Cristian a year ago

Luc VDN, this part of the code sets the color of the icon
https://github.com/traccar/traccar-web/blob/master/src/common/util/formatter.js#L117

and here you use it
https://github.com/traccar/traccar-web/blob/master/src/map/MapPositions.js#L46

this is general for all icons, but with that you have an idea of what you have to change to get what you need

alexandre vannier a year ago

Hello,

We would like to override status color on the category icon

We found information in the Github issue :
https://github.com/traccar/traccar-web/issues/805

The example below is to change color on digital input :

di1 ? "primary" : null

Is it possible to change color on the category icon with compute attribute ?

Thanks for your help.

Anton Tananaev a year ago

You found the right thing. It changes the icon color using computed attributes.

kindly share expression for the computed attribute

alexandre vannier a year ago

Hi, we didn't use custom attribute, we uploaded new svg logo and use it in a custom traccar-web build.

Result :
2024-10-18 10_50_51-Traccar.png

Screenshot 2024-10-18 091807.png

how can I achieve this in green

rowl3y a year ago

Also looking on how todo this ?