Infection mode does not apply color on image shapes
See original GitHub issueDescribe the bug When infection mode is enabled, particles.shape.type = ‘image’, and images that have the replaceColor = true property, the infection stages do not apply color to the particles.
To Reproduce Steps to reproduce the behavior:
- Use SVG images and set 'replaceColor: true
- Enable infections
- Set particle type to image.
- Observe no color change for infected particles.
Expected behavior Particles with SVG and replaceColor should change color when infected.
Screenshots
Observation of no coloring on nodes:
Changing type to ‘circle’:

Desktop (please complete the following information):
- OS: Linux KDE Plasma X11, Windows 10
- Browser Chrome, Firefox
- Version
- Chrome 84.x
- Firefox 80.x
- Edge 18.x
Additional context Tested tsParticles versions: 1.17.0, 1.17.10, 1.18.0-alpha.14
This Official CodePen suggests this is fault of upgrades in Chrome / FireFox.
Options Object:
{
fpsLimit: 60,
infection: {
enable: true,
infections: 10,
cure: true,
stages: [
{
color: "#ff0000",
duration: 10
},
{
color: "#00ff00",
duration: 10,
rate: 0
},
{
color: "#ffffff",
duration: 1,
rate: 0,
infectedStage: 0
}
]
},
particles: {
number: {
value: 70,
density: {
enable: true,
value_area: 800
}
},
color: {
value: "#ffffff"
},
shape: {
// type: "circle",
type: 'image',
image: [
{
src: "https://particles.matteobruni.it/images/sars-cov-2.png",
// src: "/img/landingpage/desktop-gray_900.svg",
replaceColor: true
}
]
},
opacity: {
value: 0.8,
random: false,
anim: {
enable: false,
speed: 3,
opacity_min: 0.1,
sync: false
}
},
size: {
value: 15,
random: false,
anim: {
enable: false,
speed: 20,
size_min: 0.1,
sync: false
}
},
line_linked: {
enable: false,
distance: 150,
color: "#ffffff",
opacity: 0.4,
width: 1
},
move: {
collisions: true,
enable: true,
speed: 10,
direction: "none",
random: false,
straight: false,
out_mode: "bounce",
attract: {
enable: false,
rotateX: 600,
rotateY: 1200
}
}
},
interactivity: {
detect_on: "canvas",
events: {
onhover: {
enable: false,
mode: "repulse"
},
onclick: {
enable: false,
mode: "push"
},
resize: true
},
modes: {
grab: {
distance: 400,
line_linked: {
opacity: 1
}
},
bubble: {
distance: 400,
size: 40,
duration: 2,
opacity: 0.8,
speed: 3
},
repulse: {
distance: 200
},
push: {
particles_nb: 4
},
remove: {
particles_nb: 2
}
}
},
retina_detect: true
}```
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (6 by maintainers)
Top Results From Across the Web
Color and Shape Settings - Esko
Trap Color Intensity. By default, PowerTrapper uses the full color of the object to spread in the trap (100% trap color intensity). However,...
Read more >Add fills to text and shape layers – Figma Help Center
Paints are colors, gradients, or images. Fills are just one of the ways you can use paints in Figma. Apply paints to text...
Read more >Use basic color controls in Motion - Apple Support
In Motion, the color controls set the color of objects such as shapes, text, replicators, particles, and gradients.
Read more >Add a fill or effect to a shape or text box - Microsoft Support
Do one of the following: To add or change a fill color, click the color you want. To choose no color, click No...
Read more >Apply colors and gradients | Illustrator on the iPad
Fill color is the color contained in the shape object and stroke is the border of the shape object. The fill or stroke...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Exactly, images are good for performances when they are static since there’s less to draw on the canvas, but every color change is an image to load and that loading is bad at runtime.
Using the font could be good, but try to see if the performances are still good since the text is a bit slower than the image
So changing svg colors through
replaceColoris not supported? In that case, I will probably switch to thechartype instead of image and use the Font Awesome font.