<?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>Forem: Emily Carlin</title>
    <description>The latest articles on Forem by Emily Carlin (@emilycarlin).</description>
    <link>https://forem.com/emilycarlin</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F334749%2Fd4d27883-6118-4250-8265-f8a48214c0c6.jpeg</url>
      <title>Forem: Emily Carlin</title>
      <link>https://forem.com/emilycarlin</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/emilycarlin"/>
    <language>en</language>
    <item>
      <title>Hacking Auto-Layout to Make a Progress Bar in Figma </title>
      <dc:creator>Emily Carlin</dc:creator>
      <pubDate>Fri, 17 Jul 2020 19:14:26 +0000</pubDate>
      <link>https://forem.com/emilycarlin/hacking-auto-layout-to-make-a-progress-bar-in-figma-27ek</link>
      <guid>https://forem.com/emilycarlin/hacking-auto-layout-to-make-a-progress-bar-in-figma-27ek</guid>
      <description>&lt;p&gt;I recently watched &lt;a href="https://www.youtube.com/watch?v=fNQRXierLhQ"&gt;a recording&lt;/a&gt; from Figma's "Office Hours" series. &lt;/p&gt;

&lt;p&gt;The session was all about components. They covered a ton of great stuff. There's something for everyone -- from those in the early days of their component journey to advanced component creators. &lt;/p&gt;

&lt;p&gt;One thing they mentioned offhandedly (a little too offhandedly, for how cool and useful it is!) is using auto-layout to hack an editable progress bar component. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SnWQy7SG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/b8hu985qv58xrrqwo9uu.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SnWQy7SG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/b8hu985qv58xrrqwo9uu.gif" alt="A progress bar filling in response to adjustments to horizontal spacing in auto-layout panel in Figma"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This really caught my eye. I work on a budgeting tool called &lt;a href="https://www.youneedabudget.com/"&gt;You Need a Budget (YNAB)&lt;/a&gt;. As you can probably imagine, simple "progress bar" data visualizations are quite useful to help people quickly make sense of their money and how they're doing on achieving their financial goals. &lt;/p&gt;

&lt;p&gt;In the past, if we wanted to add a "progress bar" component to our design system, we would have to create a bunch of different variants (e.g. 25% full, 50% full, etc.) to represent various states of completion, because you can't override the width of elements within a component. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mMuXL1ae--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/x8f6i0mcciydijxlvqf9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mMuXL1ae--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/x8f6i0mcciydijxlvqf9.png" alt="A different component for 25% completion, 50% completion, and 75% completion"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This autolayout hack will allow us to create a single "progress bar" component that designers can adjust to whatever width they'd like. Pretty handy!  &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QMlMe-cq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/bjq2ydj7j2stebfk3xo3.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QMlMe-cq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/bjq2ydj7j2stebfk3xo3.gif" alt="A single progress bar component changing width"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Here's how to do it:
&lt;/h3&gt;

&lt;h4&gt;
  
  
  1. Create a container frame
&lt;/h4&gt;

&lt;p&gt;This will be the background of your progress bar component, so give it whatever dimensions and styling you'd like. I chose a simple bright yellow background with sharp corners: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YMFcy9cc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/drxxfa5f4lcpxj6f3m24.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YMFcy9cc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/drxxfa5f4lcpxj6f3m24.png" alt="A 48x420 bright yellow bar on a gray background"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  2. Create a "progress bar" frame within the container frame
&lt;/h4&gt;

&lt;p&gt;Style this however you'd like your progress bar to look. Don't have to worry about its width, for now -- we'll make that editable in the next steps. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SPGmrLG3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/hasczxk6wa39qaw6pr5x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SPGmrLG3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/hasczxk6wa39qaw6pr5x.png" alt="A frame within a frame, with a blue color applied"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  3. Create rectangle in the center of the progress bar frame.
&lt;/h4&gt;

&lt;p&gt;This is where things get weird but cool. Just do it - you'll see why in the next step :) Make it 1px wide and go from the very top to the very bottom of your progress bar frame. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YVJedEY2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/f3l02505p18dsmxkri60.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YVJedEY2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/f3l02505p18dsmxkri60.png" alt="A thin red rectangle within the blue frame we created above"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  4. Add auto-layout to the progress bar frame
&lt;/h4&gt;

&lt;p&gt;You can do this by selecting the progress bar frame and hitting shift+a or by adding auto-layout from the right-hand properties panel. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ytOL_5Dj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/s53023zhfnbqjn9x5w7k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ytOL_5Dj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/s53023zhfnbqjn9x5w7k.png" alt="Auto-layout enabled in the inspector on the righthand side"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  5. Make the rectangle in the progress bar frame invisible
&lt;/h4&gt;

&lt;p&gt;You can do this a number of ways -- I chose to simply remove the fill. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--J2wFMZEX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/283pf8wyy7y6gzcyulb0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--J2wFMZEX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/283pf8wyy7y6gzcyulb0.png" alt="The rectangle is still present in the layers list but you can't see it; it doesn't have a fill or stroke"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  5. That's it!
&lt;/h4&gt;

&lt;p&gt;You can now adjust the horizontal padding on the progress bar frame to increase/decrease the size of the progress bar, like so:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QSvkFWV5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/r407rfbf9r2r941rrbzq.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QSvkFWV5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/r407rfbf9r2r941rrbzq.gif" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This works because auto-layout is applied to the parent container -- in this case, the progress bar. The only element within the parent container is the invisible rectangle. &lt;/p&gt;

&lt;p&gt;So when you add horizontal padding to either side of the rectangle, that ends up increasing the parent container's (i.e. the progress bar's) overall width.&lt;/p&gt;

&lt;p&gt;You can see this more clearly if I make the invisible rectangle visible; the padding on either side of it increases/decreases, which changes the overall width of the progress bar (i.e. the parent container): &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZuQ_90JN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/gzkshif0scx9wc9zcztn.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZuQ_90JN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/gzkshif0scx9wc9zcztn.gif" alt="Increasing/decreasing the padding in the auto-layout panel increases the padding on either side of a red rectangle within the blue progress bar"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And if we turn this into a component, the progress bar will remain editable because you can adjust auto-layout properties in component instances. Pretty handy! &lt;/p&gt;

&lt;p&gt;Feel free to comment with any questions. I'd also be curious how other teams are using auto-layout and if anyone has discovered any other fun "hacks" like this one :) &lt;/p&gt;

</description>
      <category>design</category>
      <category>figma</category>
    </item>
    <item>
      <title>The Practice: Semantic Colors for Developers</title>
      <dc:creator>Emily Carlin</dc:creator>
      <pubDate>Wed, 12 Feb 2020 20:15:09 +0000</pubDate>
      <link>https://forem.com/ynab/the-practice-semantic-colors-for-developers-1o6g</link>
      <guid>https://forem.com/ynab/the-practice-semantic-colors-for-developers-1o6g</guid>
      <description>&lt;p&gt;We've already covered &lt;a href="https://dev.to/ynab/a-semantic-color-system-the-theory-hk7"&gt;the theory&lt;/a&gt; behind our semantic color system as well as &lt;a href="https://dev.to/ynab/semantic-colors-for-designers-2lf2"&gt;how it works for designers&lt;/a&gt;. This post covers how it works when the rubber hits the road: In code! &lt;/p&gt;

&lt;p&gt;We believe that a design system isn’t worth much if it’s only used by designers. So when we started working on this new approach to colors, we knew we wanted to make it simple and usable for developers, too. &lt;/p&gt;

&lt;p&gt;So we &lt;strong&gt;built a Figma integration&lt;/strong&gt; that takes all of the color information from our color file and outputs usable code (special thanks/shoutout to Kyle Robinson Young on the YNAB development team, who helped build the integration). &lt;/p&gt;

&lt;p&gt;YNAB offers an iOS app, an Android app, and a web app. We rely on our design system to keep things consistent between each platform, so the integration outputs code for each platform. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F1kjkxjjx97agumuw94ec.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F1kjkxjjx97agumuw94ec.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Each platform has some idiosyncrasies as far as how colors are defined and how light/dark mode switching happens, so we’ll run through each of them. &lt;/p&gt;

&lt;h3&gt;
  
  
  iOS
&lt;/h3&gt;

&lt;p&gt;For iOS, the integration outputs a color file that is broken into two sections. This is where &lt;em&gt;all&lt;/em&gt; of our iOS app's colors are defined. &lt;/p&gt;

&lt;p&gt;The first section of the file defines the palette colors. These are private because we never refer to them directly — instead, we refer to semantic colors. This keeps things consistent and guarantees that they look good in light and dark mode. &lt;/p&gt;

&lt;p&gt;In the next section of the file, we have our semantic color definitions. These are what actually we use to apply color. Each and every semantic color points at a palette color for light mode and for dark mode. &lt;/p&gt;

&lt;p&gt;One of our iOS developers wrote a simple function, that looks at the user’s display mode and determines which color variant to display. That way, things will “just work” between modes. We also built in a safe fallback, in case users aren’t running iOS 13 yet.&lt;/p&gt;

&lt;p&gt;We use the description field of the semantic colors from Figma to populate the proper references to the base palette for each semantic color. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F4b2b7m7an2wfu759qbx5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F4b2b7m7an2wfu759qbx5.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Android
&lt;/h3&gt;

&lt;p&gt;For Android, the integration outputs to three color-related files. &lt;/p&gt;

&lt;p&gt;First, there’s &lt;code&gt;palette.xml&lt;/code&gt;. This is the base color palette where all possible colors are defined. &lt;/p&gt;

&lt;p&gt;Next, there’s &lt;code&gt;colors.xml&lt;/code&gt; and &lt;code&gt;colors.xml (night)&lt;/code&gt;. These each have each semantic color listed, with the proper reference to the base palette for each mode — light mode definitions go in palette.xml and dark mode definitions go in &lt;code&gt;colors.xml (night)&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;When we’re applying colors, we simply refer to colors defined in &lt;code&gt;colors.xml&lt;/code&gt; and the right variant renders based on the user’s mode. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fimdlo5w2r3qay1vda5q6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fimdlo5w2r3qay1vda5q6.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Web
&lt;/h3&gt;

&lt;p&gt;We use Stylus for our web app, so we output a &lt;code&gt;palette.styl,&lt;/code&gt; &lt;code&gt;colors.styl&lt;/code&gt;, and &lt;code&gt;dark-theme.styl&lt;/code&gt; file. &lt;/p&gt;

&lt;p&gt;As you can probably anticipate from the structure of iOS and Android, &lt;code&gt;palette.styl&lt;/code&gt; contains the base palette colors. ‘Colors.styl&lt;code&gt;and ‘dark-mode.styl&lt;/code&gt; contain CSS variable definitions that reference the proper base palette colors.&lt;/p&gt;

&lt;p&gt;So when we are applying colors, we use the CSS variables we define in &lt;code&gt;colors.styl&lt;/code&gt; and &lt;code&gt;dark-mode.styl&lt;/code&gt; and render the right variant based on the mode the user has selected. &lt;/p&gt;

&lt;p&gt;We haven’t released dark mode for the web, so this approach is still experimental, but we’re confident it will work just as well as the system has been working for iOS and Android. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fvxwwm9nwg8lcjz1wqd3a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fvxwwm9nwg8lcjz1wqd3a.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Communication between designers and developers
&lt;/h3&gt;

&lt;p&gt;The fact that we output color definitions directly from Figma means that when a developer looks at a design, they can use the exact same name as the designer and the code will “just work.”&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fzfibq973o3su7obz796i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fzfibq973o3su7obz796i.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The Figma integration makes it easy and lightweight to keep the system up-to-date; relying on manual updates and communication for a system like this would be a surefire way for it to quickly get out-of-date, messy, and to start to diverge between different platforms. &lt;/p&gt;

&lt;p&gt;With this system, we simply run the integration any time colors change in Figma (which is our “source of truth” for all things color). Then developers immediately get access to the latest and greatest colors. &lt;/p&gt;

&lt;p&gt;But the technical specificities here are less important than the fact that the philosophy and the language around colors are shared between designers and developers. This system gives us a shared language for talking about colors, and empowers everyone on the team to pick the right color for the job. &lt;/p&gt;

&lt;h4&gt;
  
  
  Questions? Comments? Get in touch!
&lt;/h4&gt;

&lt;p&gt;That’s all for our series on how we built a semantic color system for designers and developers at YNAB! Feel free to reach out if you have any questions or suggestions. Our hope is that this system can be as useful to other teams as it has been to us! &lt;/p&gt;

</description>
      <category>design</category>
    </item>
    <item>
      <title>The Practice: Semantic Colors for Designers</title>
      <dc:creator>Emily Carlin</dc:creator>
      <pubDate>Wed, 12 Feb 2020 19:58:24 +0000</pubDate>
      <link>https://forem.com/ynab/semantic-colors-for-designers-2lf2</link>
      <guid>https://forem.com/ynab/semantic-colors-for-designers-2lf2</guid>
      <description>&lt;p&gt;In this post, we’ll cover how the semantic color approach we described in the &lt;a href="https://dev.to/ynab/a-semantic-color-system-the-theory-hk7"&gt;first post&lt;/a&gt; works for designers, in practice. &lt;/p&gt;

&lt;h3&gt;
  
  
  Setting colors up in the design system
&lt;/h3&gt;

&lt;p&gt;Our team’s design tool of choice is Figma, but most of what we describe here could also be accomplished in Sketch (and perhaps other design tools). &lt;/p&gt;

&lt;p&gt;Out of the box, Figma only supports one layer of abstraction for colors. You define a style, and that’s that. Here’s how we set things up to support our additional layer of abstraction:&lt;/p&gt;

&lt;p&gt;First, we create a file in our &lt;code&gt;Design System&lt;/code&gt; project called &lt;code&gt;Colors&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;On one page, we set up our base palette. These base palette colors constitute each and every color that can possibly appear in our apps. We make these colors private to the file by prepending a &lt;code&gt;.&lt;/code&gt;to the style name. That way, the base palette colors won’t even appear when we publish the color file as a library. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fqg1wo3sqri41iu919otp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fqg1wo3sqri41iu919otp.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On a new page, we define our semantic colors.&lt;/p&gt;

&lt;p&gt;For each semantic color style, we define one light mode version and one dark mode version. In theory, we could define as many as we’d like (maybe we want a “super dark” mode, etc.) &lt;/p&gt;

&lt;p&gt;We name these colors with the following convention: &lt;/p&gt;

&lt;p&gt;&lt;code&gt;Group Mode/Specific&lt;/code&gt; &lt;/p&gt;

&lt;p&gt;&lt;code&gt;Groups&lt;/code&gt; are things like “Label” “Background” “Header” etc. Mode corresponds to whether the given color is for light or dark mode. And &lt;code&gt;Specific&lt;/code&gt; corresponds to the particular usage of the color within the group. This produces colors like:&lt;/p&gt;

&lt;ul&gt;

&lt;li&gt;The semantic color for primary actions, &lt;code&gt;Primary Action&lt;/code&gt; is defined with the styles &lt;code&gt;Primary Light/Action&lt;/code&gt; and &lt;code&gt;Primary Dark/Action&lt;/code&gt; &lt;/li&gt;
&lt;li&gt;The semantic color for accents within headers, &lt;code&gt;Header Accent&lt;/code&gt; is defined with the styles &lt;code&gt;Header Light/Accent&lt;/code&gt; and &lt;code&gt;Header Dark/Accent&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;The semantic color for our default labels, &lt;code&gt;Label Default&lt;/code&gt; is defined as &lt;code&gt;Label Light/Default&lt;/code&gt; and &lt;code&gt;Label Dark/Default&lt;/code&gt;
&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;As you can see, the light/dark style variants of each of our semantic colors is where we have to hack our way past Figma’s single-layer concept of color. &lt;/p&gt;

&lt;p&gt;We further push Figma’s approach to color by denoting the base palette color that each semantic color references in the style’s description field. In the example below, you can see that &lt;code&gt;Primary Action&lt;/code&gt; points to &lt;code&gt;primary600&lt;/code&gt; in light mode and &lt;code&gt;primary500&lt;/code&gt; in dark mode. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fjlz5se0fjq6lnttewuox.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fjlz5se0fjq6lnttewuox.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This description is what connects the semantic color to the base palette color, via a custom plugin that we wrote. Whenever we change our base palette colors, our plugin will automatically update the semantic colors for us, so that we never have to do anything manually.&lt;/p&gt;

&lt;p&gt;This description also comes in handy later when we export these colors from Figma to usable code — more on how that works in part 3, where we discuss how this system works for developers. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fairp0z7cfk5nf6t716ry.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fairp0z7cfk5nf6t716ry.gif" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Using the colors file as a library in other files
&lt;/h3&gt;

&lt;p&gt;When we publish the color file, designers have access to all of the semantic colors. &lt;/p&gt;

&lt;p&gt;Each and every color has a light mode and a dark mode variant that are in the same position and have the same name within the color inspector. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fdckxn41z77shfi4m8llu.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fdckxn41z77shfi4m8llu.gif" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So to get a dark mode version of a screen, you can simply toggle each color to use the dark mode variant. This means we don’t have to maintain different components for different modes — everything happens at the level of individual colors. &lt;/p&gt;

&lt;p&gt;To make this even easier for designers to use, we plan to build a plugin that automatically flips colors from light to dark (Brian Lovin at Github already &lt;a href="https://twitter.com/brian_lovin/status/1202787778246909953" rel="noopener noreferrer"&gt;built something that does exactly this&lt;/a&gt;, though it isn’t available for public use at this point). &lt;/p&gt;

&lt;p&gt;We also plan to make a plugin (or use one that someone else has made!) that allows for type-ahead search to make color selection more ergonomic. But for now, we’ve organized semantic colors alphabetically so that designers can quickly find what they’re looking for. &lt;/p&gt;

&lt;h3&gt;
  
  
  A flexible and efficient system
&lt;/h3&gt;

&lt;p&gt;That’s all there is to it — we build our semantic color file, include it in other files, and go forth and design! &lt;/p&gt;

&lt;h4&gt;
  
  
  Questions? Want to try out our plugins?
&lt;/h4&gt;

&lt;p&gt;If you have questions about how to set this system up for designers, please feel free to ask! There’s nothing “secret” about this and we’d love for something here to be useful to other designers. &lt;/p&gt;

&lt;p&gt;We plan to publish the “semantic color updater” plugin as well as the Figma integration that outputs code (more on that in the next section) — let us know if your team is interested in trying out early versions of either one of these. &lt;/p&gt;

&lt;p&gt;The next post covers how this system &lt;a href="https://dev.to/emilycarlin/the-practice-semantic-colors-for-developers-1o6g"&gt;works for developers&lt;/a&gt; — both in the code and in terms of collaboration with designers. &lt;/p&gt;

</description>
      <category>design</category>
    </item>
    <item>
      <title>The Theory: A Semantic Color System</title>
      <dc:creator>Emily Carlin</dc:creator>
      <pubDate>Wed, 12 Feb 2020 19:35:01 +0000</pubDate>
      <link>https://forem.com/ynab/a-semantic-color-system-the-theory-hk7</link>
      <guid>https://forem.com/ynab/a-semantic-color-system-the-theory-hk7</guid>
      <description>&lt;p&gt;This post is the first in a three-part series about how our team at &lt;a href="https://www.youneedabudget.com/" rel="noopener noreferrer"&gt;You Need a Budget&lt;/a&gt; (YNAB) thinks about color in our design system. We'll go over the principles of how our system works, what inspired us to build it, and why we're excited about it. &lt;/p&gt;

&lt;p&gt;The other posts cover how the system works for &lt;a href="https://dev.to/ynab/semantic-colors-for-designers-2lf2"&gt;designers&lt;/a&gt; and for &lt;a href="https://dev.to/emilycarlin/the-practice-semantic-colors-for-developers-1o6g"&gt;developers&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;Over the past few months, the team at YNAB revamped how we approach colors in our design system. &lt;/p&gt;

&lt;p&gt;Colors are deceptively simple. They are a foundational element of interfaces but all-too-frequently end up becoming a sprawling mess of inline definitions, different naming conventions across different platforms, confusion around when to use what color, and issues with updates when things change. And dark mode support, which is becoming the norm, introduces yet another dimension of complexity to colors. &lt;/p&gt;

&lt;p&gt;Our new system addresses these challenges head-on by using a combination of semantic naming and an additional “layer of abstraction” (more on what exactly this means later) in both our designs and in code. &lt;/p&gt;

&lt;p&gt;This series is all about what we might call the “form” of colors in our design system: How we structure the system and how it works for designers and developers. &lt;/p&gt;

&lt;p&gt;This series won’t cover the “content” of colors in our design system: Things like how we selected the actual color values we use, how we ensure adequate contrast, our color decisions in designing for dark mode, etc. &lt;/p&gt;

&lt;p&gt;Okay, let’s get into it! &lt;/p&gt;

&lt;h3&gt;
  
  
  What’s in a name?
&lt;/h3&gt;

&lt;p&gt;If you’re a designer or a developer, chances are you’ve seen the words “semantic” and “color” in the same sentence before. It usually refers to a way of naming colors based on how they are used as opposed to their hue. This is one of &lt;a href="https://css-tricks.com/what-do-you-name-color-variables/" rel="noopener noreferrer"&gt;many theories&lt;/a&gt; on the best way to name color. &lt;/p&gt;

&lt;p&gt;With a semantic name, you might name a color “destructive” or “negative” — something that connotes what the color means in your interface, as opposed to something like “red” (or even something more fun, like “tomato”). &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fuf44ilf4qi6u1spp67po.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fuf44ilf4qi6u1spp67po.png" alt="Three circles named with variations on "&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Naming colors semantically has two benefits: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; &lt;b&gt;It helps designers and developers decide what color to use.&lt;/b&gt; Instead of needing to memorize or check documentation to decide what color to make a “delete” button, you simply grab the color that relates to destruction.&lt;/li&gt;

&lt;li&gt;
&lt;b&gt;It makes your color system more efficient and flexible.&lt;/b&gt; If you decide you want to update your primary color to be purple instead of blue, you simply update the value for the primary color (assuming you’re using color styles in a tool like Figma or Sketch and color variables in code). If the colors were named based on hue, you’d need to go change every single place the color is used from “blue” to “purple.” &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Our new approach to color introduces an additional layer of abstraction to address some of the problems that are left unsolved by simply naming each of your colors semantically. &lt;/p&gt;

&lt;h3&gt;
  
  
  The base palette
&lt;/h3&gt;

&lt;p&gt;A color palette is, of course, an integral piece of any design system. The palette represents the universe of possibility for color in an interface. &lt;/p&gt;

&lt;p&gt;A palette is a great start for building visually consistent apps — a defined set of colors mitigates the chance that a rogue hex value will sneak its way in. &lt;/p&gt;

&lt;p&gt;Here’s what our palette looks like at YNAB: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fysyyzhqaqmgxtzoy7kiv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fysyyzhqaqmgxtzoy7kiv.png" alt="A palette of different colors"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Each of the colors has a semantic name (e.g. &lt;code&gt;primary&lt;/code&gt;, &lt;code&gt;accent&lt;/code&gt;, etc.) as well as a number that corresponds to its lightness (e.g. &lt;code&gt;900&lt;/code&gt; for the darkest variants; &lt;code&gt;100&lt;/code&gt; for the lightest variants). But if we stopped here, a lot would still remain up for interpretation as far as when to use what color. And not in a good “&lt;em&gt;this leaves space for creativity!&lt;/em&gt;” way; more in a “&lt;em&gt;What primary color variant do we use for buttons again?&lt;/em&gt;” way. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fjtdnrxocsft300fov9g2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fjtdnrxocsft300fov9g2.png" alt="Laptop with thought bubble coming out that says "&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  The semantic colors
&lt;/h3&gt;

&lt;p&gt;Our semantic colors go further than simply naming colors based on the general realm of their usage. They are a second layer of abstraction that sits on top of the base palette. &lt;/p&gt;

&lt;p&gt;Our color system consists of two layers: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The base palette, which defines every possible color value in our app. &lt;/li&gt;
&lt;li&gt; The semantic palette, which defines colors based on how they are used. Each and every semantic color points to a color from the base palette. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For example, we have a semantic color for our primary action color and another one for the background of headers. Each of those semantic colors references a color from the base palette.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fmdogkwm5iod6dl57cy78.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fmdogkwm5iod6dl57cy78.png" alt="Two different semantic colors pointing to two different palette colors"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, you may be thinking, “This seems like a bunch of extra work for something that we get for free with symbols/components.” And in the case of something like a button or a header, that may very well be true — when you design the primary button component, you pick a color from the palette and then others simply use that component in their designs without needing to think about the specific color. &lt;/p&gt;

&lt;p&gt;But as things get more complex, the benefits of this two-layer system become clear. &lt;/p&gt;

&lt;h3&gt;
  
  
  Visual Consistency
&lt;/h3&gt;

&lt;p&gt;YNAB is budgeting software, which means that we frequently use color as a visual signal for positive and negative account balances (we never rely only on color, but color and accessibility would be a whole separate post). &lt;/p&gt;

&lt;p&gt;For example, the budget view features “pills” that display the amount remaining in a given category of a user’s budget. There is also a bar at the top of the screen that displays overall budget status. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fyla1srg30v1bkuxg39z1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fyla1srg30v1bkuxg39z1.png" alt="Two interface elements that use the same color"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To keep things consistent, we want both of these elements to use the exact same color. That way, users can start to learn that when they see this particular red color, it always means the same thing — a negative balance!&lt;/p&gt;

&lt;p&gt;In our semantic color system, we name this color &lt;code&gt;statusNegative&lt;/code&gt; and set it to reference a color from our base palette. So if we want to update this color, we simply point it at a different palette color and &lt;strong&gt;the change propagates to all elements that are meant to convey a negative status.&lt;/strong&gt; And if we update a base palette color, the change will ripple through all of the semantic colors that reference that color (and then all of the elements that use those semantic colors). &lt;/p&gt;

&lt;p&gt;This is what we mean by introducing an additional layer of abstraction. Semantic colors act as an intermediary level of specificity, between the raw value of colors in the base palette and the usage of those colors in specific components.&lt;/p&gt;

&lt;p&gt;And here’s the best part: &lt;strong&gt;Semantic colors make it easy for designers to create new elements that are visually consistent with the rest of the app.&lt;/strong&gt; If we wanted to create a graph on a dashboard that is in a negative state, we’d simply drop in &lt;code&gt;statusNegative&lt;/code&gt; instead of arbitrarily searching through our red hues. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fr14dz44r5t3ven2nrz9t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fr14dz44r5t3ven2nrz9t.png" alt="Drake frowning at disparately colored elements and smiling at cohesively colored elements"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Dark Mode
&lt;/h3&gt;

&lt;p&gt;Beyond visual consistency, a major benefit of this system is how easily it supports dark mode. In fact, adapting our apps to dark mode is what inspired this approach to color in the first place. &lt;/p&gt;

&lt;p&gt;Let’s consider the color we use for primary elements — &lt;code&gt;primaryAction&lt;/code&gt;. This color references &lt;code&gt;primary600&lt;/code&gt; from the base palette. &lt;/p&gt;

&lt;p&gt;Great. But what about dark mode? &lt;/p&gt;

&lt;p&gt;Well, &lt;b&gt;all we have to do is create an additional mapping for &lt;code&gt;primaryAction&lt;/code&gt;.&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;For dark mode, we map it to &lt;code&gt;primary500&lt;/code&gt;, a lighter blue, because we want primary elements to “pop” more on dark backgrounds (like accessibility, choosing colors for dark mode could be a whole separate article. We won’t get into the specifics here, but check out &lt;a href="https://blog.superhuman.com/how-to-design-delightful-dark-themes-7b3da644ff1f" rel="noopener noreferrer"&gt;this article&lt;/a&gt; by the team at Superhuman for a great primer). &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F2jxvt0n6jq4wezdwvedt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F2jxvt0n6jq4wezdwvedt.png" alt="One color mapping for light mode; another one for dark mode"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Each of our semantic colors points to two base palette colors: one for light mode and one for dark mode.&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;That way, we can just apply a &lt;code&gt;primaryAction&lt;/code&gt; style to our buttons and the right palette variant will render based on the user’s mode. &lt;/p&gt;

&lt;p&gt;You may be thinking: “Why can’t you just define a dark mode variant of &lt;code&gt;primary600&lt;/code&gt;? This doesn’t work because there are some colors that should get darker in dark mode (think backgrounds) and some colors that should get lighter in dark mode (think labels and accents). &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fcjgyqof8tg6jvkquiaju.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fcjgyqof8tg6jvkquiaju.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Long story short ...
&lt;/h3&gt;

&lt;p&gt;The two-layer semantic approach to colors allows us to flexibly update colors, keep our app visually consistent, and efficiently design for dark mode. &lt;/p&gt;

&lt;p&gt;The next two posts in this series will cover the ins and outs of how this system actually works — for designers and for developers. &lt;/p&gt;

&lt;p&gt;Thanks to Alan Dennis (who came up with the structure of this approach) and the rest of the YNAB design and development teams for helping to bring this system to life. &lt;/p&gt;

&lt;p&gt; Additional thanks to Alan Dennis, Dylan Mason, and Tristan Harward for giving feedback on the first draft of this post. &lt;/p&gt;

</description>
      <category>design</category>
    </item>
  </channel>
</rss>
