229 comments

[ 2.8 ms ] story [ 248 ms ] thread
(comment deleted)
Nearly 15 years late is better than never. Congrats on the upgrade :)
Here it is, in its full glory!

    <?xml version="1.0" encoding="utf-8"?>
    <svg viewBox="0 0 100 100" width="100" height="100" xmlns="http://www.w3.org/2000/svg">
      <rect x="0" y="0" width="100" height="100" fill="rgb(255, 102, 0)"></rect>
      <path d="M 50 77 L 50 50 " fill="none" stroke="rgb(255, 255, 255)" stroke-width="8.78662150719729" stroke-linecap="butt">
      </path>
      <path d="M 94.93056731583404 35.622745513916016 L 71.2454833984375 71.2454833984375 " fill="none" stroke="rgb(255, 255, 255)" stroke-width="8.78662150719729" stroke-linecap="butt" transform="matrix(1 0 0 1 -21.2455 -21.2455)">
      </path>
      <path d="M -78.93056731583404 36.17028045654297 L -55.67118835449219 71.79300689697266 " fill="none" stroke="rgb(255, 255, 255)" stroke-width="8.78662150719729" stroke-linecap="butt" transform="matrix(1 0 0 1 105.396 -21.7213)">
      </path>
      <rect transform="" width="100" height="23.742591024555463" stroke-width="1" stroke="none" fill="#FF6600" stroke-opacity="1" fill-opacity="1" stroke-linecap="butt" stroke-linejoin="miter" >
      </rect>
    </svg>
that's a lot of svg! svgo suggests the following without any manual tinkering:

  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><path fill="#F60" d="M0 0h100v100H0z"/><path fill="none" stroke="#FFF" stroke-width="8.79" d="M50 77V50m23.69-35.62L50 50M26.47 14.45l23.25 35.62"/><path fill="#F60" d="M0 0h100v23.74H0z"/></svg>
Transport compression should get it most of the way there, no? I think having human readable vector graphics is nice.
This the most HN string of replies I've seen. Cheers haha
Apart from being one-lined, the optimised version is more readable and roughly about as compressible. There’s really no reason to have transformation matrices for 2 squares and a simple polygon
transport compression isn't going to help with the unnecessary high precision coordinates.

There are also a bunch of things that are just the result of it being automatically generated by some vector package, such as the transforms, separate paths, masking of a bunch of strokes rather than just flattening the shape etc.

I see your 258 byte svgo version and raise it my 171 byte hand optimized version:

    <svg viewBox="-32 -32 64 64" xmlns="http://www.w3.org/2000/svg"><path fill="#f60" d="M-32-32h64v64h-64z"/><path fill="#fff" d="m0-5l-8-12h-7L-3 1v16h6V1l12-18H8z"/></svg>
Better still, an inline SVG fragment is only 151 bytes - and will save 318 bytes of http header:

    <svg viewBox="-32 -32 64 64" width=18 height=18><path fill=#f60 d="M-32-32h64v64h-64z"/><path fill=#fff d="m0-5l-8-12h-7L-3 1v16h6V1l12-18H8z"/></svg>
118, can we beat it anyone?

<svg viewBox="-32 -32 64 64" style="background: #f60"><path fill="#fff" d="m0-5l-8-12h-7L-3 1v16h6V1l12-18H8z"/></svg>

It doesn't need to be valid XML if you embed it in the HTML, which was their point.
Edit: I stand corrected, it does parse correctly when embedded in HTML!
By the tiniest of margins, 115. Deleted two spaces and an `l`. Largely inspired by `svgo`. Using `rsvg-convert` to render them both to PNG shows identical output between this and the 118 version. https://rjp.is/hn-svg.html seems to render them identically in Safari and Chrome.

    <svg viewBox="-32-32 64 64" style="background:#f60"><path fill="#fff" d="m0-5-8-12h-7L-3 1v16h6V1l12-18H8z"/></svg>
But not in Firefox :(
That appears to be trigged by "-32-32" (broken) vs "-32 -32" (working). Looks like this has been a long-standing weirdness in Firefox[1] where it is allowed somewhere but not other places.

On the other hand, the spec[2] does specify whitespace or commas between the viewbox numbers.

I rescind my 115 claim and reset it back to 116.

[1] https://github.com/svg/svgo/issues/12

[2] "a list of four numbers <min-x>, <min-y>, <width> and <height>, separated by whitespace and/or a comma"

We can move the fill to the style attribute and get it back down to 114:

  <svg viewBox="-32 -32 64 64" style="background:#f60;fill:#fff"><path d="m0-5-8-12h-7L-3 1v16h6V1l12-18H8z"/></svg>
Oh, if you then switch to the comma-style for viewBox, drop the / from the path tag, and drop the quotes from the style attributes, that takes it down to 109.

Safari, Chrome, and Firefox are all perfectly happy with it but then rsvg-convert chokes on all of those changes. 114 is probably the best that can be done and still be "conforming" (for want of a better word.)

viewBox can be comma-separated, so you can loose the quotes but only for inline SVG
Well, that seems to work in everything (Firefox, Safari, Chrome, rsvg-convert) and drops it down to 114. Ta!
Interesting, I never realized the Y wasn't symmetrical. The left branch is slightly lower and to the left of the right branch in the Y. This also creates a gap in the center of it at high resolutions: https://i.imgur.com/vwPnz2j.png

If this wasn't intentional, here's a symmetrical version:

    <svg width="100" height="100" viewBox="0 0 100 100" fill="none" xmlns="http://www.w3.org/2000/svg">
        <rect width="100" height="100" fill="#FF6600"/>
        <path fill-rule="evenodd" clip-rule="evenodd" d="M62.1762 23.7426H72.6857L54.3948 51.6515V76.9391H45.6048V51.6554L27.3143 23.7426H37.8233L49.9988 42.3233L62.1762 23.7426Z" fill="white"/>
    </svg>
Perhaps the asymmetry is there to subtly evoke a dip and recovery of a company's stock price. The subtext could be "we build resilient companies".
Fun fact: "Y" in your comment is not symmetrical either. Letter shapes are usually not symmetrical, Y/X/etc. even in gothic sans typefaces add asymmetries that make text easier to read.
Why use such un-round numbers though?
Now we just need the little up and down arrows to go SVG and HN can look crisp at any resolution.
Well, have I got some news for you!

https://news.ycombinator.com/triangle.svg

...and it's already implemented! I thought this day would never come.
And the down arrow is using the same SVG with a `transform: rotate(180deg)` too!

Truly incredible developments.

This is some excellent planning. When a future request comes in for east votes and west votes, they can just update the rotate() parameter and push the changes straight to prod.
If it's just a background-image, why not just build the triangle in CSS? Saves a network request (and a whopping 525 bytes)
I just want them bigger on mobile.
Why work so hard?

  ▲  U+25B2  BLACK UP-POINTING TRIANGLE
  ▼  U+25BC  BLACK DOWN-POINTING TRIANGLE
[0] https://en.wikipedia.org/wiki/Geometric_Shapes_(Unicode_bloc...
At least for me those are different sizes.
Same here, something funky going on with unicode triangles?
Which browser? So far, everything seems fine in Firefox, Chromium, and Nyxt, which uses WebKit.
Looks fine on Edge/Windows too.
I feel like this unicode approach may be a better fit for how the rest of Hacker News is constructed (e.g. the use of the pipe character).
(comment deleted)
Glad to see technology is finally here for it
The designer who did this had to invest really so much time... :-)
Excellent.

Now if the mobile view could space items out a touch more so I don't periodically fat thumb the tiny flag/hide article links it would be perfect!

HN on mobile is a usability nightmare.
I would make the fold-a-post-button a bit bigger and with more space to the left. The rest seems clickable to me.
How's your vision, hand-eye-coordination, and fine motor control?
The accidental Hide is the worst because you can’t just undo… it’s gone (unless you go to the Hidden page)!
A long-press for flagging/hiding would be great (or even a confirmation-screen).
Or accidentally logging out when you wanted to click on your profile to see if your comments had any responses / votes.
Why not click on "threads" in the top bar?
Doesn't help for viewing your submissions.
Commenting from Materialistic on Android, it's a great app ime.
I use Octal on iOS. Highly recommended.
Dark mode too please?
The “Dark Reader” browser extension works fine for most websites, including HN.
It would be good to have native dark mode without the need for different browser extensions or hacks. This way we would be able to read HN from mobile, tablet, computer no matter what the browser or OS is.
Looks like the colors are SVG fill properties, that could be refactored to be controlled with CSS instead and swap on readers using dark mode
Good. Now HN just needs to add video embedding, limitless scrolling and social media sharing.
Don't even joke about those things!
Don't forget the promise of running on Helion(tm) fusion power!
Don't forget GIF replies. That's what makes Twitter such a swell place, everyone is just so hilarious.
But we could have <blink> on some important text to be truely different...
We just got rid of a Gif - let's jump straight to SVG replies!
Well they did just add some JS scrolling crap. Come on HN I thought you were better than that.
Glad to see it, but it probably could have just been a "Y" and some CSS too
Sounds like a nightmare to check the logo in every combination of OS and rendering engine to make sure the 'Y' is perfectly centered in the box and has the same weight.

SVG doesn't change the way positioned text does.

It doesn't have the same weight or even shape as the old one, so I'm honestly not sure this was a priority. But in principle you are right, SVG is the correct choice.
The proportions have changed. Compare e.g.: https://news.ycombinator.com/favicon.ico

EDIT: since we're code golfing/bikeshedding, here's my own attempt, which matches the original proportions [1].

    <?xml version="1.0"?>
    <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 192 192">
      <rect x="4" y="4" width="188" height="188" fill="#f60" stroke="#fff" stroke-width="8"/>
      <path d="m 57,47 h 15 l 24,50 24,-50 h 15 L 102,109 v 40 H 90 v -40 z" fill="#fff"/>
    </svg>
[1] Actually, the original is slightly asymmetric -- the right leg is slightly narrower. I've "corrected" this, making the right leg mirror the left.
Golfing SVG happens to be one of my passions. Your path definition can be further reduced to

    m57 47h15l24 50 24-50h15l-33 62v40h-12v-40z
What framework does this use and how can I turn it into monthly revenue?
267 bytes vs 1026 :)

<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><path fill="#F60" d="M0 0h100v100H0z"/><path d="M50 77V50M73.685 14.377 50 50M26.465 14.449l23.26 35.623" fill="none" stroke="#FFF" stroke-width="8.787"/><path fill="#F60" d="M0 0h100v23.743H0z"/></svg>

I mean really you should measure it after gzip/brotilli since that is the size that matters.
You're right - still smaller but now 199 vs 448 bytes.

Wonder if it can be made any smaller?

    <div style=“background-color:orange;color:white;border:1px solid white”>Y</div>
?

Disclaimer: from memory and tongue in cheek. May not work!

It matters client-side in RAM. ;)
Why on Earth didn't you just inline it?
So that it gets cached by the browser?
In this case the extra request to the server (and associated response) to check if the file has been modified is several times larger than the minified size of the SVG inline. It's literally faster and fewer requests to inline it.
Wow, let's not get carried away with crazy new technologies and radical redesigns.
Oh that ship already sailed. Click on the "parent" link. Notice that it breaks your browser history now because instead of being a link to an element in the document it runs some javascript to scroll the page… commence teeth gnashing.
This is why, on almost every website I visit where I know I'll be opening multiple links (which would normally require hitting the back button to view them all), I just open every link in a new tab and then close the tab when finished.

I suspect many people use HN (and similar) this way.

It's always a fun time when I occasionally use the browser/website "as intended" and hit the back button, but the scroll position has been completely lost so it takes a bit to find the exact place I was looking originally.

Sure, and I do that too. This is for navigating within the page though, and no I'm not going to open a new tab per comment I want to read.
Launching a pixel-based competitor for people that like HN the way it used to be, like and subscribe for more important announcements
Save on that bw cost!
The day has finally come. Thank you YC.
Wow, amazing. It's a shame I can't downvote this post.
(comment deleted)
Does it look right?
It's a relief, especially the arrows.
Arrows look sharp but the Y is not bold enough to look much different than a plain orange square now.

White square border looks good though.

1920 x 1080 on Firefox, plain orange square even more so on the browser tabs.

> the Y is not bold enough to look much different than a plain orange square

Seconded, it feels like the spacing between the Y and the borders is a bit too large. I would make the Y a bit thicker.

Other than that, it looks good. Voting arrows particularly so. I have memories of browsing HN on the TV at >200% zoom, the logo was very blurry in that situation.