Skip to content

How can I change image preview background #52

@lelikflegma

Description

@lelikflegma

Hi. Currently, when I upload image, preview background-color is calculated and settled like average color of uploaded image. So, for original PNG, with transparent body
image
I got :
image

I found in html this :

<span class="file-preview image-preview" style="background-color: rgb(80, 65, 250);">

When i comment style, i got this :
image

For remove gray backround i can override css property "background" in :

.vue-file-agent .file-category-video-playable .file-preview .file-preview-overlay, .vue-file-agent .file-preview-wrapper-image .file-preview .file-preview-overlay {...}

image

and for remove grid :

.vue-file-agent .file-preview .file-preview-img {...}

image

But how can I remove setting "average" color background ?

In source code i found function :

public color(): string {
    if (this.imageColor) {
      const rgb = this.imageColor;
      return 'rgb(' + rgb[0] + ', ' + rgb[1] + ', ' + rgb[2] + ')';
    }
    if (this.isImage()) {
      return 'transparent';
    }
    const ext = this.ext();
    const svgIcon = this.icon();
    // var svgIcon = getIconFromExt(ext);
    if (svgIcon.color) {
      return svgIcon.color;
    }
    return utils.getColorForText(ext);
  }

And property imageColor :

imageColor: RGBA;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions