Problem/Motivation

The default project image (images/puzzle-piece-placeholder.svg), used for projects with no logo, is not optimized. Actually, it's not even a real vector image, it's a PNG image embedded into an SVG. The result is an unnecessarily large 10.7kB file.

The code:

<svg width="81" height="80" viewBox="0 0 51 80" fill="none" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<path d="M0.5 2C0.5 0.895429 1.39543 0 2.5 0H78.5C79.6046 0 80.5 0.895431 80.5 2V80H0.5V2Z" fill="url(#pattern0)"/>
<defs>
<pattern id="pattern0" patternContentUnits="objectBoundingBox" width="1" height="1">
<use xlink:href="#image0_1502_4331" transform="scale(0.00462963)"/>
</pattern>
<image id="image0_1502_4331" width="216" height="216" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSU...
                                                                  ^^^^^^^^^^^^^^^

Steps to reproduce

Open images/puzzle-piece-placeholder.svg in a text editor and you'll see the code above.

Proposed resolution

I'm attaching a new SVG file (1.1kB) made by me, containing a vector version of the existing image.

I'm also attaching another version, with a solid gray-bluish background, which, IMO, looks better than the white background version. Here's a screenshot of how it would look like:

Project Browser page with alternative project image

Remaining tasks

  • ✅ File an issue about this project
  • ☐ Manual Testing
  • ☐ Code Review
  • ☐ Accessibility Review
  • ☐ Automated tests needed/written?
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

gedvan created an issue. See original summary.

chrisfromredfin made their first commit to this issue’s fork.

chrisfromredfin’s picture

Created two branches to reflect the two options. One just the smaller SVG, one the alternate SVG.

Smaller SVG (first) vs. Alternate (second):
simple grey outline puzzle piece
puzzle piece over darker background

Thoughts from folks?

chrisfromredfin’s picture

Status: Active » Needs review
lostcarpark’s picture

I definitely favor a proper SVG image for the "puzzle piece" image. The image above looks good. I do rather like the version with the colored background. I wonder how it would look with the color inside the puzzle piece only?

lostcarpark’s picture

StatusFileSize
new9.51 KB
new285.72 KB

I've had a look at the alternative image, I notice it has rounded corners. I think it should have square corners like the project logos. Here's the current image:

Alternative logo with rounded corners.

The other version has a transparent background, so no corner issues.

I did a mockup based on Chris's images with a version of the logo with a filled in puzzle piece, but with no background around the puzzle piece.

Another mockup with solid puzzle piece

bsnodgrass’s picture

lostcarpark’s picture

@ravi kant, I see you've created MR !376, but haven't added any commits yet. Happy to add my SVG from #8 if it's useful. It's modified from your original vector image.

ravi kant’s picture

According to me, Logo with background color and round corner is looking good.

lostcarpark’s picture

@ravi kant, I agree the logo looks good.

However, please see the Project Browser documentation on logos at: https://www.drupal.org/docs/contributed-modules/project-browser/module-m...

Specifically, the guideline says: (Please note: you should not round the corners in the PNG itself, unless there is some compelling branding reason. We will round corners when displaying in the Project Browser.)

Although that's referring to project logos, I think the part about rounded corners applies to the placeholder image too. The rounded corners should be added by CSS rather than part of the image. When it renders in the browser, it will have rounded corners.

Hope that clarifies.

lostcarpark’s picture

StatusFileSize
new289.08 KB

I've added my version of the puzzle piece to MR !376.

This is a screenshot showing it in a development environment.

Screenshot showing solid puzzle piece with clear surround.

lostcarpark’s picture

So to summarise, we currently have three options:

  • MR !357 - SVG version of the original puzzle piece image.
    My concern with this one is may lack sufficient contrast on some backgrounds.
    MR!357
  • MR !356 - White puzzle piece on blue background.
    I would be happy with this one if the rounded corners are corrected, as the rounding should be applied by CSS.
    MR!356
  • MR !376 - Light blue puzzle piece with dark blue outline on transparent background.
    I have offered this as an alternative option.
    MR!376
rkoller’s picture

356 -might have a potential color contrast issue. the puzzle piece in white (#ffffff) on the background (#bbcddd) has a color contrast of 1.6:1 and SC1.4.11 (ui components and graphical objects) has a minimum requirement of of 3:1. (and i notice 357 has the similar problem grey on white has probably also only 1.6:1. aside the color contrast issue i would also rather tend to either 356 or 376. 357 perishes (hope that is the correct term) in contrast to projects that have colorful project icons.

lostcarpark’s picture

Good points, @rkoller. Note that !357 is not a white background, but a transparent background, so it will show on the background of the theme. This will be white in Claro, but won't always in other themes. For example, Gin offers a dark mode. My worry is that if an admin theme with a grey background becomes popular, the icon could disappear completely.

volkswagenchick’s picture

I do like having the alternative image for color contrast for dark mode or inverted color schemes.

rkoller’s picture

yes my comment was totally claro centric. but i was aware that 357 is transparent. and yes on a dark theme in gin (and claro in the future) 357 would be close to invisible. therefore +1 for the suggestion @volkswagenchick brought up, having an alternative image if a darkmode is in place. that way things would be future proof. and i wonder if it would make sense to add something like PB inside the puzzle piece. at the moment it isn't necessarily clear that the icon is the default no project icon available icon or the actual icon of a project. by adding something like the project browser initials it might help to signify that?

lostcarpark’s picture

StatusFileSize
new12.34 KB

I've put together a contrast test image showing the three versions on a white, mid-grey, and black background:

Puzzle piece contrast test

chrisfromredfin’s picture

I like option 2 the best because I like that it takes up the "full size" of the icon space, which I like to happen by default. But that's my only issue and I'm happy to be outvoted if we can get a consensus around one of them. :)

rkoller’s picture

i've quickly checked all the nine variants with color contrast analyzer and listed the resulting color contrasts:

357:
icon to background 1.6:1. 2.5:1 13.1:1

356:
icon to background. 1.6:1. 2.4:1. 13:1
puzzle to icon 1.6:1

376:
outline to background. 5:1 1.3:1 4.2:1
outline to inside puzzel. 3.1:1

I agree with #21 having an icon taking up the full size is nice. but going with a single icon instead of light and dark mode variants, the blueish background needs some adjustment to improve the contrast against white and grey background as well as the currently white puzzle outline inside needs some update. each don't meet the 3:1.

and comparing 357 and 376 the latter is the more robust. a single grey outline for each background doesnt work except against the black background. the only slight problem the darker blue outline is close to invisible against a grey background and even though it has a high enough color contrast against the black the dark blue outline nearly vanishes vanishes visually.

lostcarpark’s picture

StatusFileSize
new274.9 KB

I have made a change to the version in MR !356 (white puzzle piece on blue background).

I changed the box to square, and darkened the background to increase contrast.

I discovered that the image size was only 80x80 pixels, when the preview logos are 100x100, so it wasn't hitting the edges and the CSS rounding wasn't affecting it. To resolve this, I resized the placeholder image to a default of 512x512 to match the logo images. The logos on cards will shrink but not enlarge, and it now displays the same size as other logos and has rounded corners applied.

Here is a preview:

Puzzle piece on darker blue background.

I haven't added to a MR yet, as I thought I should get feedback first.

I have also rebased all three MR branches as they were quite a few commits behind.

lostcarpark’s picture

I have tried adding a slight gradient to the background, which I think gives it a more dynamic look, and also should look at least somewhat distinct from almost any background color. The contrast between the image background and the puzzle piece should be strong enough that it should stand out regardless.

I've attached screenshots showing it in light and dark mode on the Gin theme:

Gradiant puzzle piece in light mode

Gradiant puzzle piece in dark mode

There are some issues with how Project Browser displays in Gin, but the main point is that it looks clear in both.

I have opened MR !378 with this image.

(Also accidentally pushed this to MR !376, but have reverted).

chrisfromredfin’s picture

Status: Needs review » Fixed

Love this; contrast is great.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.