7 ms·
Show HN: Pattern.css – CSS-only library to fill empty background with patterns
- nathancahill 7y agoAlso see Hero Patterns: http://www.heropatterns.com http://www.heropatterns.com by Steve Schoger.
- Etheryte 7y agoSubtle Patterns [1] has been fairly popular throughout the years as well. [1] https://www.toptal.com/designers/subtlepatterns/ https://www.toptal.com/designers/subtlepatterns/
- mikehearn 7y agoAlso Transparent Textures (https://www.transparenttextures.com/ https://www.transparenttextures.com/) – disclaimer, I made it — which is basically Subtle Patterns with a colorwheel that allows the backgrounds to be any color.
- urza 7y agoThis is great! Is it possible to download the whole collection?
- swyx 7y agoi have more here, and just added some by you https://github.com/sw-yx/spark-joy/blob/master/README.md#user-content-patterns https://github.com/sw-yx/spark-joy/blob/master/README.md#use...
- CSSer 7y agoThis is pretty cool. It’s reminds me of https://css-doodle.com/ https://css-doodle.com/, which is a native web component with the same general goal. Iirc, it uses canvas under the hood.
- tiborsaas 7y agoPretty neat project and great presentation, starred! You could reduce the distributed CSS version even more if you used the gradient definition only once, it's always the same. background-image: repeating-linear-gradient(45deg, currentColor 25%, transparent 25%, transparent 75%, currentColor 75%, currentColor), repeating-linear-gradient(45deg, currentColor 25%, transparent 25%, transparent 75%, currentColor 75%, currentColor); With class composition it's easy: .pattern-checks.xl { background-position: 0 0, 100px 100px; background-size: calc(2 * 100px) calc(2 * 100px); } But if you added a copy-paste ready snippet to the landing page, that would be great too.
- gorpomon 7y agoI always love seeing small, yet very valuable and informative projects on the front-page-- bravo!
- gunn 7y agoLike it says, <1kB minified and gzipped. But 9.5kB only minified, i.e. The css is highly repetitive so gzip is able to do a lot. I know it's still small, but I'd be tempted to extract just the rules I wanted. Very nice regardless.
- extro 7y agoExample site ( https://bansal.io/pattern-css https://bansal.io/pattern-css ) misrendered in Vivaldi, which brings me back PTSD grade memories about the browser war and css bugs, implementation-diferences, etc. So let me ask, how is it possible on the almost completely monoculturized web, where is no Presto and almost no Trident anymore, where almost every browser is kind of chrome-isotope. So let me ask, maybe a web developer cn answer me: what is missing to be able to provide complete support forthe main browsers? Is there still prefixed css tags? OR is it so hard to handle differences between browsers/browser-versions? Doesn't CSS have any graceful fallback functionality for older browsers? Why is this phenomen exists today?
- ahofmann 7y agoIs also not rendered correctly in Firefox 75 (Linux, PC)
- jedimastert 7y agoCan you provide a screenshot?
- 7y ago
- Funes- 7y ago>>Features >Only CSS. No JavaScript! It is indeed a feature, and one that I wish the vast majority of websites adopted.
- deleted 7y ago[deleted]
- zerkten 7y agoI really like this, but it would be great if the example site didn't use that scrolling. I wanted to click between examples and I browsed away because it took too long. Bookmarked for my next project though.
- tiagok 7y agoI miss so much k10k . The best patterns ever ! https://kottke.org/11/10/so-long-kaliber10000 https://kottke.org/11/10/so-long-kaliber10000
- Accacin 7y agoWonderful! The demo site hijacks my back button, and the animations are incredibly slow. Edit: Rereading made me sound very salty. Nice project and I'm sure I'll use it in the future.
- queercode 7y agoLove it! Site could use some help though. Consider making a repo for the actual website please! Would love to help clean it up a bit.
- greencore 7y agoI bet this will the hottest web-design trend for next two years.
- malydok 7y agoIf you don't need to install stuff from npm and prefer to hack your own, here's a nice list of CSS patterns to get you started: https://leaverou.github.io/css3patterns/ https://leaverou.github.io/css3patterns/
- chrismorgan 7y agoThe website https://bansal.io/pattern-css https://bansal.io/pattern-css was clearly produced on a platform with overlay scrollbars. There are a number of horizontal scrollbars that shouldn’t be there. .overflow-scroll { overflow: scroll !important; } `overflow: scroll` is pretty much never what you want: it draws scrollbars whether needed or not. You want `overflow: auto` instead, which doesn’t draw scrollbars unless necessary. .w-100vw { width: 100vw !important; } Viewport units are fundamentally broken by design. Don’t ever use them for layout. In fact I recommend against using them in any situation at all. In this case, use `width: 100%` or just nothing, and it’ll yield the desired results.
- tekromancr 7y ago> Viewport units are fundamentally broken by design. Don’t ever use them for layout. In fact I recommend against using them in any situation at all. That's a pretty bold claim. Can you elaborate on that?
- chrismorgan 7y agoSome comments I’ve made here on the topic: https://news.ycombinator.com/item?id=21244656 https://news.ycombinator.com/item?id=21244656 https://news.ycombinator.com/item?id=20956850 https://news.ycombinator.com/item?id=20956850 The currently-implemented viewport units are just fundamentally bad. And I’ve only been talking about the badness of vw; vh has further troubles of its own on mobile.
- JoshTriplett 7y agoWhat was Firefox's former behavior for viewport unit handling that other browsers didn't want to go with?
- chrismorgan 7y agohttps://github.com/w3c/csswg-drafts/issues/1766 https://github.com/w3c/csswg-drafts/issues/1766 is the main link that explains it, https://bugzilla.mozilla.org/show_bug.cgi?id=1468684 https://bugzilla.mozilla.org/show_bug.cgi?id=1468684 is also useful.
- jaquers 7y agoThanks for the patterns, they look great! Some have commented about the usability of the sidebar / js autoscroll, which could be improved—but it is functional and am I gonna use this as my homepage or am I gonna configure this into my project one time when I need it?! ... jeesh, lighten up.
- truesy 7y agoreminds me of the 'ol stripe generators, that were big in the early 2000s
- harrisreynolds 7y agoThis is very cool. I'd like to include this library in the website builder we've built for Webase [1]. We currently have a color background and an image background but these patterns would make it easy for non-coders to add some panache! Thank you for sharing! [1] https://www.webase.com https://www.webase.com
- detaro 7y agoHm, the diagonal lines are rendering quite badly for me (randomly jagged edges). Anyone else seeing this? (I'm on Linux, FF75)
- spankalee 7y agoIt'd be nice if this used CSS variables so that you didn't need hardcoded sm, md, lg, and xl sizes, but could set the size to any length. Looks like from the source that this would cut the size by 75%.
- calibas 7y agoWorks great in Chrome, but many of them aren't smooth in Firefox. It doesn't seem to like diagonal lines, the display is inconsistent. I'm guessing it's a bug in Firefox with sub-pixel rounding.