Jacob Berglund

Jacob Berglund

@jacobberglund.com

Frontend consultant @ variant.no. I like making simple and delightful things for the web. I'm a "lets solve it with HTTP, HTML, CSS, JS"-person. In that specific order.

41 followers101 following77 posts

Jacob Berglund reposted

After testing 100s of imgs comparing tiny and big changes to the algo: I am now confident to present to you: The new okpalette.color.pizza. Powerful as before, ~40% faster, better at detecting good presets and much better at finding rare colors! Test it with your pics and let me know what you think

A continuation of my <color-mode> rambling yesterday. OKLCH take the wheel! If a palette is something to be changed and inherited, we could extend with a semantic layer too. And what happens next is positively fascinating. Allow me to demonstrate 🧵

I feel like I've stumbled upon something close to magic in regards to how I want to build design system in the future. This feels like 4x2 and 2x2 LEGO. Not the overly specific ones like a green banana. Colors need not be handpicked in Figma. Color systems will be building blocks instead. kthx!

A continuation of my <color-mode> rambling yesterday. OKLCH take the wheel! If a palette is something to be changed and inherited, we could extend with a semantic layer too. And what happens next is positively fascinating. Allow me to demonstrate 🧵

A continuation of my <color-mode> rambling yesterday. OKLCH take the wheel! If a palette is something to be changed and inherited, we could extend with a semantic layer too. And what happens next is positively fascinating. Allow me to demonstrate 🧵

A continuation of my <color-mode> rambling yesterday. OKLCH take the wheel! If a palette is something to be changed and inherited, we could extend with a semantic layer too. And what happens next is positively fascinating. Allow me to demonstrate 🧵

Patterns starts to emerge. The middle one is inverted and has a shadow. The classes inside remains the same, subtle is still subtle. Button is still button, though it went from an outlined button to a filled one. Button inherits color from the inverted tokens. 🤯

A continuation of my <color-mode> rambling yesterday. OKLCH take the wheel! If a palette is something to be changed and inherited, we could extend with a semantic layer too. And what happens next is positively fascinating. Allow me to demonstrate 🧵

There's actually two semantic layers. A "normal" one and an inverted one. Here's a demonstration of two <color-modes>, the inner one inherits from the first. Both can be inverted independent of each other.

Jacob Berglund reposted

Make your logo brighter than white. Chris Bennett built a tool that turns a logo into a gain-map JPEG, so the colors you pick shine up to 7.5 times brighter than plain white on HDR screens and stay a normal JPEG everywhere else. #color #image www.soverybright.com/

I’m starting to think that colors set in hex (or the like) is akin to magic numbers. Relative colors and color-mix() unlocks a whole bunch new patterns. Example: Borders colors should be relative to backgrounds. Add alpha to it instead of specific hex values.

I’m starting to think that colors set in hex (or the like) is akin to magic numbers. Relative colors and color-mix() unlocks a whole bunch new patterns. Example: Borders colors should be relative to backgrounds. Add alpha to it instead of specific hex values.

This opens up borders to be a semantic, regardless of what background it rest on. Subtle or strong is a matter of how much alpha. Sure, it technically becomes different colors based on the background, but I believe it to be an OK trade off. Ugly example from a test bench:

Been hard at work to create an opinionated CSS framework. Best thing in it is what I dubbed <color-mode>. It sets a a color palette and everything inherits from it. The possibilities it opens for composing is positively bonkers. Got 4 different button variants, but color is not an axis. 🧵

It has a few semantic class names for text color and surfaces. These change color depending on the palette chosen in <color-mode>. In other words: color is inherited. Same goes for backgrounds. And why stop there? Also did ”inverted”, which flips it all. In essence a doubling of potential!

Here are 2 different color-modes. Grey and blue. Both as inverted and non-inverted, in dark mode. Light mode would look different. What a time to be alive!

Been hard at work to create an opinionated CSS framework. Best thing in it is what I dubbed <color-mode>. It sets a a color palette and everything inherits from it. The possibilities it opens for composing is positively bonkers. Got 4 different button variants, but color is not an axis. 🧵

Jacob Berglund reposted

🔥 New blog post: Dark mode toggles that expose three states (system, light, dark) seem like the best option. Until you think about user goals, that is. Before rushing to disagree, hear me out. lea.verou.me/blog/2026/da... PS: As a data point, @jakearchibald.com was converted after reading this 😅

lea.verou.meDark mode toggles: two states are enough • Lea VerouYes, the underlying model must have three states, but one is always irrelevant to the actual user goal. Users do not seek out solutions to problems they don’t currently have. A lot of the hate towards...

How do you do ”default” link styling without interfering if there’s other classes being added to it? Like it looking like a button for example :not([class]) is too much smartness.

Sorry if I’m late to the party, but it occurred to me that cascade layers can be used to show the most important CSS at the top. Like a button with variants. I want the variants up top and not the base. Without cascade layers this requires smartness™. Nice.

It makes some assumptions: It posts on blur with a custom header (X-Enhance-Validate). You gotta for that header that, do the validation and not doTheThings(). Make sure you return the same form with a 422 status code. And that's pretty much it. Hey-o!

Jacob Berglund reposted

Just shipped bsky-comments! Embed Bluesky threads anywhere with a zero-dependency Web Component. • Framework Agnostic (Native WC) • < 3kb gzipped • Zero Config: Just paste the Post URL • Light DOM: Fully customizable (CSS/Tailwind) github.com/florianschep... #webdev #opensource #buildinpublic

What is a combobox if not a popover, a text input to filter checkboxes/radios? Move the input, add in some arrow navigation and a programmatic click() and you got yourself a A+ LightDOM web component. The progressive enhancement is that it’s just a popover with some radios/checkboxes.

Jacob Berglund reposted

over a year ago, i gave a talk at the xoxo conference about a mural, a mcdonald’s, and a man. (but it was also secretly about life, and legacy, and meaning.) finally, i’m blogging the full story, with behind-the-scenes details, and a video of the talk. enjoy. cabel.com/wes-cook-and...

cabel.comWes Cook and the Centralia McDonald's MuralA personal story about discovering a mural in a McDonald's, an unknown artist named Wes Cook, saving the mural, and a conference talk about the whole thing.

The light dismiss on popover is a game changer. Stacked drawers nested inside each just works as expected. Like…wat? Since when do I not need to bend the arcane arts of the DOM to my liking? Positively delightful.

As browsers have been getting prrrretty good at removing the need for JS with things like popover, view transitions and so on, I do believe the time for simpler stacks is upon us. Experimenting with hono to just HTML and, dare I say, it is quite delightful. 2026: progressive enhancement is back!

Imagine a form, on a page, with an action which points to itself. That form works ANYWHERE on the site. Now slap a web component on it which prevents the full reload, does fetch instead and swaps the content. Validation ✅ On success redirect is also just HTML, win-win.