Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make a default avatar with transparent background and adaptive coloring based on username #1357

Draft
wants to merge 42 commits into
base: main
Choose a base branch
from

Conversation

TheVillageGuy
Copy link
Contributor

Code works flawlessly, just have to create a default avatar and somehow point to it from the code

Copy link
Contributor

This PR is stale because it has been open 40 days with no activity.

@github-actions github-actions bot added the Stale Inactivity for too long label Feb 18, 2025
@github-actions github-actions bot removed the Stale Inactivity for too long label Mar 14, 2025
@TheVillageGuy TheVillageGuy changed the title Make a default avatar with static background color based on username Make a default avatar with transparent background and adaptive coloring based on username Mar 14, 2025
.gitignore Outdated
/.vs/mbin/CopilotIndices/17.12.68.61481/CodeChunks.db-wal
/.vs/mbin/CopilotIndices/17.12.68.61481/SemanticSymbols.db-shm
/.vs/mbin/CopilotIndices/17.12.68.61481/SemanticSymbols.db-wal
/.gitignore
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not ignore .gitignore!

@@ -272,3 +272,10 @@ $RECYCLE.BIN/
*.msi
*.msm
*.msp
/.vs/mbin/CopilotIndices/17.12.68.61481
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be reduced to a single: /.vs

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is vs such a pita

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this image looks like it is created in Ms Paint? The borders are very pixelated. You do know that we have very quality infinitely sharp SVG files? https://github.com/MbinOrg/mbin/blob/main/assets/images/sources/mbin-notext.svg

These can be opened in Inkscape. edited and then exported to PNG if you wish to use png.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my response below. I did all the work for you already now. You can just take that SVG content and only modify the style in the <stop ..> section to any color you want for either the foreground or background.

@@ -1,13 +1,13 @@
<div class="user-popover">
<header>
{% if user.avatar %}
{#% if user.avatar %#}
Copy link
Member

@melroy89 melroy89 Mar 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you disable this? I think this should just be removed, right?

@melroy89
Copy link
Member

I will make it easier for you. Here is the svg in raw plain text:

<svg
   width="320"
   height="320"
   viewBox="0 0 320 320"
   version="1.1"
   id="svg1"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:svg="http://www.w3.org/2000/svg">
  <defs
     id="defs1" />
  <rect
     style="display:none;opacity:1;fill:#29144a;fill-opacity:1;stroke:none;stroke-width:4.39823;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:1"
     id="rect35"
     width="323.65826"
     height="325.41187"
     x="0"
     y="-2.7059329" />
  <g
     id="g1"
     transform="matrix(0.97092512,0,0,0.95099897,34.423647,35.890832)">
    <g
       id="layer1"
       style="display:inline;fill:none"
       transform="matrix(2.12871,0,0,2.0000001,-90.126008,15.218211)">
      <path
         id="path5"
         style="display:inline;opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:1"
         d="m 97.229482,-27.966661 a 5.0000002,5.0000002 0 0 0 -4.330895,2.500455 L 23.616552,94.533014 a 4.9999999,4.9999999 0 0 0 4.330895,7.500336 H 166.51152 a 4.9999996,4.9999996 0 0 0 4.32995,-7.500336 l -69.28204,-119.99922 a 5.0000002,5.0000002 0 0 0 -4.329948,-2.500455 z M 97.247442,7.1649804 140.54977,82.164236 H 123.22998 L 110.23918,59.664254 97.247437,82.164236 84.256642,59.664254 71.266792,82.164236 H 53.946047 Z m 0,14.9996456 -10.824875,18.749814 a 7.5008819,7.5008819 0 0 0 0,7.500337 L 97.247437,67.164591 108.0742,48.414777 a 7.4997612,7.4997612 0 0 0 0,-7.500337 z"
         transform="translate(5.8501312,19.942587)" />
    </g>
  </g>
</svg>

@melroy89
Copy link
Member

melroy89 commented Mar 17, 2025

I will make it easier for you. Here is the svg in raw plain text:

<svg
   width="320"
   height="320"
   viewBox="0 0 320 320"
   version="1.1"
   id="svg1"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:svg="http://www.w3.org/2000/svg">
  <defs
     id="defs1" />
  <rect
     style="display:none;opacity:1;fill:#29144a;fill-opacity:1;stroke:none;stroke-width:4.39823;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:1"
     id="rect35"
     width="323.65826"
     height="325.41187"
     x="0"
     y="-2.7059329" />
  <g
     id="g1"
     transform="matrix(0.97092512,0,0,0.95099897,34.423647,35.890832)">
    <g
       id="layer1"
       style="display:inline;fill:none"
       transform="matrix(2.12871,0,0,2.0000001,-90.126008,15.218211)">
      <path
         id="path5"
         style="display:inline;opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:1"
         d="m 97.229482,-27.966661 a 5.0000002,5.0000002 0 0 0 -4.330895,2.500455 L 23.616552,94.533014 a 4.9999999,4.9999999 0 0 0 4.330895,7.500336 H 166.51152 a 4.9999996,4.9999996 0 0 0 4.32995,-7.500336 l -69.28204,-119.99922 a 5.0000002,5.0000002 0 0 0 -4.329948,-2.500455 z M 97.247442,7.1649804 140.54977,82.164236 H 123.22998 L 110.23918,59.664254 97.247437,82.164236 84.256642,59.664254 71.266792,82.164236 H 53.946047 Z m 0,14.9996456 -10.824875,18.749814 a 7.5008819,7.5008819 0 0 0 0,7.500337 L 97.247437,67.164591 108.0742,48.414777 a 7.4997612,7.4997612 0 0 0 0,-7.500337 z"
         transform="translate(5.8501312,19.942587)" />
    </g>
  </g>
</svg>

I will make it even even easier for you..

Here you go:

<svg
   width="320"
   height="320"
   viewBox="0 0 320 320"
   version="1.1"
   id="svg1"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:svg="http://www.w3.org/2000/svg">
  <defs id="defs1">
    <!-- Define a linear gradient for the background -->
    <linearGradient id="bgGradient" x2="0%" y2="100%">
      <stop offset="0%" style="stop-color:#d244f0;stop-opacity:1" />
      <stop offset="100%" style="stop-color:#301a6f;stop-opacity:1" />
    </linearGradient>
    <!-- Define a vertical linear gradient for the logo with an abrupt color transition -->
    <linearGradient id="logoGradient" x1="0%" y1="0%" x2="0%" y2="100%">
      <stop offset="0%" style="stop-color:#2de2e6;stop-opacity:1" />
      <stop offset="80%" style="stop-color:#3399ff;stop-opacity:1" />
      <stop offset="80%" style="stop-color:#f61ab6;stop-opacity:1" />
      <stop offset="100%" style="stop-color:#f61ab6;stop-opacity:1" />
    </linearGradient>
  </defs>
  <!-- Background rectangle with gradient fill -->
  <rect
     width="320"
     height="320"
     fill="url(#bgGradient)" />
  <g
     id="g1"
     transform="matrix(0.97092512,0,0,0.95099897,34.423647,35.890832)">
    <g
       id="layer1"
       style="display:inline;fill:none"
       transform="matrix(2.12871,0,0,2.0000001,-90.126008,15.218211)">
      <path
         id="path5"
         style="display:inline;opacity:1;fill:url(#logoGradient);stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:1"
         d="m 97.229482,-27.966661 a 5.0000002,5.0000002 0 0 0 -4.330895,2.500455 L 23.616552,94.533014 a 4.9999999,4.9999999 0 0 0 4.330895,7.500336 H 166.51152 a 4.9999996,4.9999996 0 0 0 4.32995,-7.500336 l -69.28204,-119.99922 a 5.0000002,5.0000002 0 0 0 -4.329948,-2.500455 z M 97.247442,7.1649804 140.54977,82.164236 H 123.22998 L 110.23918,59.664254 97.247437,82.164236 84.256642,59.664254 71.266792,82.164236 H 53.946047 Z m 0,14.9996456 -10.824875,18.749814 a 7.5008819,7.5008819 0 0 0 0,7.500337 L 97.247437,67.164591 108.0742,48.414777 a 7.4997612,7.4997612 0 0 0 0,-7.500337 z"
         transform="translate(5.8501312,19.942587)" />
    </g>
  </g>
</svg>

Example: https://melroy89.w3spaces.com/svg-example-1.html (cool huh?).

This allows you to add any colors for both the background or foreground. Any gradient you like. In any way or form you like.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants