Support for svg images in q-img placeholder-src
See original GitHub issueIs your feature request related to a problem? Please describe.
We’re currently using the 'face.png file in
<q-img>`:
<template>
<div>
<q-chip clickable @click="goToProfilePage" class="absolute-right">
{{ profile.givenName || t('general.welcome') }}
<q-avatar class="q-avatar--right">
<q-img
:src="photo"
spinner-color="black"
width="38px"
transition="scale"
ratio="1"
placeholder-src="img/account.png"
/>
</q-avatar>
</q-chip>
</div>
</template>
Which is correctly visible in the header like we want:
The only downside is that when darkMode is enabled the placeholder-src
image is not visible as it is black and transparant. So we tried using the svg file by storing it in \public
. But whatever we try we can’t get it to show as a placeholder.
Describe the solution you’d like
Support for .svg
and material icons.
Describe alternatives you’ve considered
Simpy using two different .png
files, one for darkMode and one for not darkMode.
Additional context Small codepen. I asked the same question on Discords but no answer, so I’m asking it here.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
How to use SVG as a Placeholder, and Other Image ...
We know SVGs are ideal for vector images. In most cases we want to load a bitmap one, so the question is how...
Read more >Simple Image Placeholders with SVG
A little open-source utility from Tyler Sticka that returns a data URL of an SVG to use as an image placeholder as needed....
Read more >How to use SVG as a Placeholder, and Other Image ...
The idea is that it is based on the image you are loading and should help making the transition between no image to...
Read more >next.js - is it possible to use a svg as a placeholder for ...
Is it possible to import a svg and use it as a placeholder until the image finish loading? I tried to create a...
Read more >Dynamic SVG image placeholders
HTML ; 1. <h1>Cloudinary SVG Placeholder</h1> ; 2. ; 3. <div class="column"> ; 4. <p>Dynamic SVG image placeholders, powered by <a href="https://cloudinary.com/"> ......
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 FreeTop 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
Top GitHub Comments
Sorry about the duplicate, had some issues posting the question. We could do your suggestion @hawkeye64 but that leads to extra images and it would be great to keep the bundle small. Ideally we would just like to use only one svg with different arguments, being
fill="black"
orfill="white"
.Thank you Dan, I must be doing something wrong then because I couldn’t make that work. Anyway, it’s proven it does, so the mistake must be on my part. Thank you for the example. closing this one.