Jacob Berglund's Avatar

Jacob Berglund

@jacobberglund.com.bsky.social

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

28 Followers  |  76 Following  |  9 Posts  |  Joined: 13.11.2024  |  1.5699

Latest posts by jacobberglund.com on Bluesky

Jacob Berglund: Rethinking Color: A designer-developer's guide to modern color systems – Refill 2025
YouTube video by Variant Jacob Berglund: Rethinking Color: A designer-developer's guide to modern color systems – Refill 2025

Here’s me, talking about colors, how to put it in systems and most importantly, OKLCH youtu.be/pQ0asU6mB1I

#oklch #css #designsystem #designsystems

19.05.2025 15:19 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0
Preview
Build for the Web, Build on the Web, Build with the Web – CSS Wizardry What is the real, long-term cost of adopting a JavaScript framework?

🧠 Some brief thoughts on front-end frameworks and upgrade hell:
csswizardry.com/2025/01/buil...

23.01.2025 13:09 β€” πŸ‘ 108    πŸ” 42    πŸ’¬ 9    πŸ“Œ 2
Preview
@scope, relative colors and oklch ...

:scope, oklch and relative colors has the potential to make colors in CSS a bit more managable without a hundred globally defined colors.

Thumbs with oklch is broken, but there are colors in there, I promise!

codepen.io/jacobberglun...

11.12.2024 08:37 β€” πŸ‘ 2    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

Neat! That makes total sense, hehe. Very much in the spirit of HTML. Thank you for sharing. πŸ™ŒπŸ»

24.11.2024 10:59 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

The pattern obviously doesn't do well when the semantic element matters, but instead of div with a lot of classes I'd say it could be useful. Even more so because you'd still be able to use classes:

<flex-stack horizontal gap="small" class="subtle-background">

24.11.2024 08:59 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0
Preview
flex-stack ...

Would it be OK using non-registered Custom Elements as a fancy div with some styling? No JS, only CSS.

Say, instead of having classes on a div like .flex-horizontal and .flex-gap-small, you could <flex-stack horizontal gap="small">?

Demo: codepen.io/jacobberglun...

#webcomponents

24.11.2024 08:53 β€” πŸ‘ 2    πŸ” 0    πŸ’¬ 2    πŸ“Œ 0

Oooooh, shiny! 🀩

24.11.2024 08:32 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0
<if- (="2 + 2 === 4")>
  <console- log(="Hello World")></console->
</if->

<if- (="2 + 2 === 4")> <console- log(="Hello World")></console-> </if->

class IfDash extends HTMLElement {
  static observedAttributes = ["("]

  _innerHtml = null

  connectedCallback() {
    this._innerHtml = this.innerHTML

    const condition = this.getAttribute("(")
    this._setCondition(eval(condition))
  }

  attributeChangedCallback(name, oldValue, newValue) {
    if (this._innerHtml === null) {
      return
    }

    if (name === "(") {
      const a = !!eval(oldValue)
      const b = !!eval(newValue)
      if (a !== b) {
        this._setCondition(b)
      }
    }
  }

  _setCondition(value) {
    this.innerHTML = value ? this._innerHtml : ""
  }
}

class ConsoleDash extends HTMLElement {
  connectedCallback() {
    const log = this.getAttribute("log(")
    console.log(log)
  }
}

customElements.define("if-", IfDash)
customElements.define("console-", ConsoleDash)

class IfDash extends HTMLElement { static observedAttributes = ["("] _innerHtml = null connectedCallback() { this._innerHtml = this.innerHTML const condition = this.getAttribute("(") this._setCondition(eval(condition)) } attributeChangedCallback(name, oldValue, newValue) { if (this._innerHtml === null) { return } if (name === "(") { const a = !!eval(oldValue) const b = !!eval(newValue) if (a !== b) { this._setCondition(b) } } } _setCondition(value) { this.innerHTML = value ? this._innerHtml : "" } } class ConsoleDash extends HTMLElement { connectedCallback() { const log = this.getAttribute("log(") console.log(log) } } customElements.define("if-", IfDash) customElements.define("console-", ConsoleDash)

With the power of web components, HTML really can be a programming language.

20.11.2024 05:42 β€” πŸ‘ 199    πŸ” 38    πŸ’¬ 24    πŸ“Œ 12
Preview
@scope, relative colors and oklch ...

Attempt 231: Cascading color scales! Experimented with @scope and relative colors to allow children to inherit their color from an element instead of :root. I'm certain that this really is going to be really useful once browser support gets better.
codepen.io/jacobberglun...

20.11.2024 13:00 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0
A comic. First panel: someone labeled "Designer" passes a note labeled "SVG" to a person labeled "Developer".

Second panel: Developer opens the note to find a long unreadable string starting with "data:image/png"

A comic. First panel: someone labeled "Designer" passes a note labeled "SVG" to a person labeled "Developer". Second panel: Developer opens the note to find a long unreadable string starting with "data:image/png"

Hi new web dev followers! Here's the best tweet I've managed in 12 years, just so you know where the ceiling is on this account

19.11.2024 16:50 β€” πŸ‘ 896    πŸ” 89    πŸ’¬ 25    πŸ“Œ 6
Video thumbnail

Been doing a lot of color stuff lately and this is the result πŸ€“ Apart from the bezier curve to set some custom properties it is pretty much just CSS. OKLCH and relative colors doing the heavy lifting. 🦭

18.11.2024 08:45 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0
4 panels of images. Top left is a dude hugging a dog, captioned "Developers". The dog is captioned "Developer Experience". There's a sad looking cat in the background.

In the third panel there's a zoomed shot of the cat, labelled "Users trying to load the website you built"

4 panels of images. Top left is a dude hugging a dog, captioned "Developers". The dog is captioned "Developer Experience". There's a sad looking cat in the background. In the third panel there's a zoomed shot of the cat, labelled "Users trying to load the website you built"

15.11.2024 12:32 β€” πŸ‘ 221    πŸ” 35    πŸ’¬ 6    πŸ“Œ 3

To lower the pressure of posting something clever or profound as a first post, I'll just say "Hello!".

Hello!

Nice. Nailed it.

14.11.2024 14:20 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

@jacobberglund.com is following 20 prominent accounts