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

Logo SVG improvements #74

Open
6 of 8 tasks
ndorfin opened this issue Sep 11, 2021 · 5 comments · May be fixed by #80
Open
6 of 8 tasks

Logo SVG improvements #74

ndorfin opened this issue Sep 11, 2021 · 5 comments · May be fixed by #80

Comments

@ndorfin
Copy link
Contributor

ndorfin commented Sep 11, 2021

Hi @matuzo
I was looking at the HTMHell logo, and it looks like it could be improved by:

  • re-using the pentacle side shapes and rotating each one,
  • replace the background path with a circle
  • using strokes on each pentacle side to cover the circle, or a mask
  • only include the 'heaven' part of the logo when needed
  • Compressing the SVG using SVGOMG (major byte difference)
  • Maybe: Re-use letters (significant byte difference)
  • Maybe: add classes to the SVG to toggle its use-cases
  • Maybe: make it responsive. Show supporting text when container size is wide and tall enough.

Let me know if this is OK, and I'll issue a PR.
-S

@ndorfin
Copy link
Contributor Author

ndorfin commented Sep 11, 2021

Technique

By setting up one of the arms of the pentacle as a symbol <path>, I could <use> and rotate the other 4 arms into their places.

The pentacle group then became the basis for a <mask>, which after adding stroking and a <rect> background, the mask cut the sharp angles out of the new circle of the pentacle.

By using the re-use system for the letters, I was able to reduce all the duplicate letters.

(Everything in red here is a symbol, or re-used in a <use> element)

Output

The results are encouraging.

  • Original image: 53KB
  • New image: 35KB

After using SVGOMG (and comparing g-zipped):

  • Current implementation logo.txt: 10.8KB (baseline)
  • Original image: 5KB
  • New image: 4KB

Considerations:

  • ✅ Greatly reduced file-size (34% of the original)
  • ✅ We're very close to being able to inject the SVG into the document now, and keep the document below the fabled 14KB.
  • ✅ We have more semantic elements to work with (circle), masks to animate, etc.
  • ✅ We can selectively add layers to the SVG (e.g. adding the 'Heaven' state) in a declarative way

@ndorfin
Copy link
Contributor Author

ndorfin commented Sep 11, 2021

@matuzo
Copy link
Owner

matuzo commented Sep 14, 2021

I forgot to run it through svgomg? What a n00b. :)

Pretty impressive work. How many hours did you spend? Please create a PR and I'll be happy to merge it any time.

@ndorfin
Copy link
Contributor Author

ndorfin commented Sep 14, 2021

About 1-2 hours for the logo changes

But most of that was learning. e.g.:

@ndorfin ndorfin linked a pull request Sep 15, 2021 that will close this issue
@simevidas
Copy link

I noticed that the SVG logo does not render when JavaScript is disabled. It looks like the SVG’s “innards” are dynamically fetched at https://www.htmhell.dev/assets/logo.txt and injected into the <svg> element.

Is this dependence on JavaScript necessary? Could the entire SVG code be located in an external SVG file and then added to the page as an image without the need for JavaScript?

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 a pull request may close this issue.

3 participants