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

Replace top gradient PNG with linear-gradient #166

Merged
merged 3 commits into from
Mar 2, 2024
Merged

Conversation

paulirish
Copy link
Owner

First.. big thanks to #132 and #88 (@xplosionmind and @jakeparis) who both did similar work. But I've been a super stickler for accuracy and wanted a pixel perfect match to the YT gradient.

Turns out 13 years ago Nicole Sullivan inspired some folks to make exactly the tool that we needed: https://www.stubbornella.org/2011/04/25/css-3-gradients/

I used https://github.com/bluesmoon/pngtocss/ to get the exact gradient definition. (Perfect alpha values are typically the part that's hard to get by hand).

YT's png file is 198px but is displayed within a div thats 98px tall. So then we just needed to take half of the values, double the color stop positions.. and then code-golf the bytes down.

Overall it's a 161 byte savings. But more importantly one less network request (yes data-uri's still invoke a whole bunch of network request stuff in the browser).

@paulirish paulirish merged commit 8fef795 into master Mar 2, 2024
2 checks passed
@paulirish paulirish deleted the linear-gradient branch March 2, 2024 23:46
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.

None yet

1 participant