<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Wolfr</title>
    <description>The latest articles on DEV Community by Wolfr (@wolfr).</description>
    <link>https://dev.to/wolfr</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4112578%2F89376cd5-6095-4d8c-919e-41e653ace7c4.jpg</url>
      <title>DEV Community: Wolfr</title>
      <link>https://dev.to/wolfr</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/wolfr"/>
    <language>en</language>
    <item>
      <title>Opacity within variables, and how it affects a shadcn design system token implementation</title>
      <dc:creator>Wolfr</dc:creator>
      <pubDate>Mon, 07 Sep 2026 14:35:32 +0000</pubDate>
      <link>https://dev.to/wolfr/opacity-within-variables-and-how-it-affects-a-shadcn-design-system-token-implementation-3ehg</link>
      <guid>https://dev.to/wolfr/opacity-within-variables-and-how-it-affects-a-shadcn-design-system-token-implementation-3ehg</guid>
      <description>&lt;p&gt;&lt;strong&gt;Technical considerations in the design of the Obra shadcn/ui kit&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Thursday last week, Figma released the opacity within variables feature, which allows authors to use an opacity percentage while keeping a color bound to a variable.&lt;/p&gt;

&lt;p&gt;We have been looking how to implement this correctly in our kit.&lt;/p&gt;

&lt;p&gt;A lightweight change we already made is the following: the new &lt;code&gt;neutral/0&lt;/code&gt; and &lt;code&gt;neutral/1000&lt;/code&gt; tokens (new since 2.0) are tied to alpha vars. These two variables are bound to white and black by default.&lt;/p&gt;

&lt;p&gt;This was released in the &lt;a href="https://www.figma.com/community/file/1514746685758799870/obra-shadcn-ui-kit-community-edition" rel="noopener noreferrer"&gt;Community File&lt;/a&gt; and will soon be released in the Pro files. &lt;/p&gt;

&lt;p&gt;As a result of this change, if you reskin your neutrals, your backdrop will change color too, as well as any other place you used alpha variables.&lt;/p&gt;

&lt;p&gt;The next part of this story is about implementing the feature to improve the kit as a whole.&lt;/p&gt;

&lt;p&gt;In this blog post we give you a “behind the scenes” with some info on the thinking behind how we can leverage this feature to improve the kit.&lt;/p&gt;

&lt;p&gt;The driving values of our Obra shadcn/ui kit are simplicity, adaptability (i.e. easy to theme) and following the logic behind shadcn.&lt;/p&gt;

&lt;p&gt;Any implementation is always an interpretation. Figma as a design app doesn’t have the same features CSS does. As a result, historically, some design aspects from shadcn have been implemented differently in Figma.&lt;/p&gt;

&lt;p&gt;Figma tends to update their app and new features in Figma often lead to new capabilities and as a result, a need for a revision of our implementation.&lt;/p&gt;

&lt;p&gt;An easy example from around February of this year is implementing slots. Figma supports slots, slots are great, and as a result, we  go and do the work of implementing them.&lt;/p&gt;

&lt;p&gt;But as “library authors” we often run into bugs first, since we take a feature that we try and immediately adapt to our kit.&lt;/p&gt;

&lt;p&gt;A new feature often leads to a dance between what Figma is able to provide (and fix), how shadcn is evolving and what we think is a good idea.&lt;/p&gt;

&lt;p&gt;As we considered the new “opacity in variables” feature, a lot of thoughts came to our mind. &lt;/p&gt;

&lt;p&gt;There’s a lot of aspects to it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The new Figma feature can help us getting rid of how we use multiple fills (e.g. on a destructive buton)

&lt;ul&gt;
&lt;li&gt;This is something we desperately want, for different reasons

&lt;ul&gt;
&lt;li&gt;The multiple fills UI in Figma has some historical unsolved bugs, where if you try to add a second fill, it just overrides the first fill.&lt;/li&gt;
&lt;li&gt;We reported this to Figma but it was never fixed.&lt;/li&gt;
&lt;li&gt;Now we see that the multiple fills UI is not even officially supported anymore: only “legacy” layers that have multiple fills seem to have proper support, but building a composite of 2 layers with variables is not even easy anymore; you’d need access to a “legacy” layer to copy and paste from. We are unsure if this is a bug or an intended feature.&lt;/li&gt;
&lt;li&gt;Conceptually, using multiple fills is sometimes the same as what shadcn does on the code level (they blend different color together using color-mix), and sometimes it’s not (see below)

&lt;ul&gt;
&lt;li&gt;It’s odd to use that Figma seems to be removing the capability to add multiple fills on top of each other. &lt;/li&gt;
&lt;li&gt;It would be better if Figma implemented color-mix for variables to have parity with CSS, but that’s another story.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Multiple fills are difficult to understand for novice to intermediate Figma users, this is the reasoning why we want to get red of them&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Another aspect to consider shadcn itself being inconsistent with its own variable usage

&lt;ul&gt;
&lt;li&gt;A general example is that the same aspect of a component (for example a background) sometimes uses two semantic&lt;/li&gt;
&lt;li&gt;Another aspect is that the same variable is sometimes used both for a border as well as a background (the input token is the primary example)&lt;/li&gt;
&lt;li&gt;Part of me wants to be 100% compliant with shadcn

&lt;ul&gt;
&lt;li&gt;Another part of me doesn’t want to implement what is clearly a bug to make the kit worse&lt;/li&gt;
&lt;li&gt;Another part knows that recreating a dev-first implementation in Figma is always going to be an interpretation&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;We have filed a &lt;a href="https://github.com/shadcn-ui/ui/issues/11763" rel="noopener noreferrer"&gt;related bug&lt;/a&gt; in shadcn where we try to work on a solution. We immediately got a PR back, but it contains its own problems. Our first conclusion is that it’s probably better for shadcn to implement a new variable (split input bg and input border in distinct variables)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So, what can we do from our POV?&lt;/p&gt;

&lt;p&gt;Since our work directly relates to hundreds of design systems in Figma, we went the extra mile to try it from the source.&lt;/p&gt;

&lt;p&gt;Shadcn is a one-man band. Either shadcn likes our idea and implements it or he doesn’t.&lt;/p&gt;

&lt;p&gt;We have considered several options for the Figma kit to move forward without any change to shadcn:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Implement specific variables on the component level using a pattern like component/destructive/button/bg - where the values can be different across modes

&lt;ul&gt;
&lt;li&gt;Doing this across the board would introduce 500+ extra variables, as well as implementation complexity&lt;/li&gt;
&lt;li&gt;This is something we want to avoid, extra variables and a “third layer” of components creates complexity we don’t want &lt;/li&gt;
&lt;li&gt;This is something that competing kits who let users switch between the 8 shadcn styles using variable modes implemented. Our approach (with multiple files) leads to at 500+ variables. The approach of competing kits, already having this layer of component level variables, leads to huge publishing times, up to 90+ minutes (we verified this independently), or even unpublishable files (as opposed to 7 minutes for the initial publish for Obra shadcn/ui)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Implementing the above but only for the “bug” layer (introduces 11 variables) (proposal to call this layer “compatibility”)

&lt;ul&gt;
&lt;li&gt;The token architecture would look like this: 11 variables named in the pattern [use-case/value-for-light-mode+opacity/value-for-dark-mode+opacity]

&lt;ul&gt;
&lt;li&gt;for example &lt;code&gt;bg-destructive-40-destructive-20&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;or in cases when the semantic variable changes &lt;code&gt;bg-transparent-input-30&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;These variable names are definitely weird and would only make sense to someone understanding the underlying bug&lt;/li&gt;
&lt;li&gt;We could create related docs, but in my experience, people don’t read the docs

&lt;ul&gt;
&lt;li&gt;This solution gives better parity with shadcn, but doesn’t actually help most person customizing the kit: they now have 11 weird variables to deal with that should not be there in the first place,. &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In my opinion the correct solution is a fix in shadcn itself, where &lt;/p&gt;

&lt;p&gt;a) The implementation where the usage of semantic variable is changed across modes should be deemed illegal&lt;br&gt;
b) Some cases of mixing up the variables border, muted and input could be cleaned up&lt;br&gt;
c) Possibly, a split should be made between what is a control surface (e.g. the track of a slider, the background of a switch) and what is a border of a control&lt;/p&gt;

&lt;p&gt;Shadcn is elegant because it’s so simple. But it looks like shadcn has one variable too little.&lt;/p&gt;

</description>
      <category>design</category>
      <category>frontend</category>
      <category>tools</category>
      <category>ui</category>
    </item>
  </channel>
</rss>
