question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for svg images in q-img placeholder-src

See original GitHub issue

Is 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: image

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:closed
  • Created 3 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
DarkLite1commented, Jan 14, 2021

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" or fill="white".

0reactions
DarkLite1commented, Jan 19, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found