<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Davyd Geyl on Medium]]></title>
        <description><![CDATA[Stories by Davyd Geyl on Medium]]></description>
        <link>https://medium.com/@davyd.geyl?source=rss-bde649bd90e6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*tZOyavUshtagpLvU9UKAlQ.jpeg</url>
            <title>Stories by Davyd Geyl on Medium</title>
            <link>https://medium.com/@davyd.geyl?source=rss-bde649bd90e6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 05:13:03 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@davyd.geyl/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Design System from Scratch: Colour Naming System.]]></title>
            <link>https://medium.com/@davyd.geyl/design-system-from-scratch-colour-naming-system-dcb05be4b9af?source=rss-bde649bd90e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/dcb05be4b9af</guid>
            <category><![CDATA[figma]]></category>
            <category><![CDATA[color-names]]></category>
            <category><![CDATA[design-system-tips]]></category>
            <category><![CDATA[mobile-application-design]]></category>
            <category><![CDATA[design-system-operations]]></category>
            <dc:creator><![CDATA[Davyd Geyl]]></dc:creator>
            <pubDate>Fri, 27 Dec 2024 08:17:55 GMT</pubDate>
            <atom:updated>2025-09-14T00:33:41.039Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k4v9gt09MYkky1dnzdHuwg.png" /></figure><p>In the <a href="https://medium.com/design-bootcamp/design-system-from-scratch-part-1-colours-17cf4850996d">previous article</a>, we discussed <strong>why</strong> the two-layered colour system is the best choice for a design system. In every design system I’ve worked on since, one question keeps coming up: “<strong><em>How</em></strong><em> do we choose the best names for colours?</em>”</p><p>While understanding <strong>why</strong> a two-layered colour system works is critical, the <strong>how</strong> of naming colours is equally important in practice. Everyone’s process will differ, but I’ve decided to share my naming approach for two key reasons.</p><p>Firstly, it will give you a good head start and save you a lot of time. This approach to naming has stood the test of time. It has been used across design systems for 5 different companies, ranging from startups to large enterprises.</p><p>Secondly, in order to form the names of the colour aliases, we will have to clarify some concepts. Clarifying these concepts early not only simplifies later conversations but also ensures consistency in your design system.</p><p>Whether naming base colours or aliases, one guiding principle remains the same: <strong>practicality</strong>. This principle equally applies to every other aspect of our design system.</p><p>If a particular naming makes you more productive — it’s a good naming system. If, however, a particular naming adds us extra administrative work and steals our time in the long run, such approach is counter productive.</p><h3>Base Colour Names</h3><p>Base colour names are essential for ensuring clarity and usability in your design system. Their purpose is to <strong>describe the colours themselves without implying any specific usage</strong>. Here are the key principles for naming base colours:</p><ul><li><strong>Visually Intuitive:</strong> Names should immediately convey the visual essence of the colour.</li><li><strong>Devoid of Purpose:</strong> A base colour name should not describe its use.</li><li><strong>Unique Within the Palette:</strong> Every base colour name must be distinct to avoid confusion.</li></ul><p>There are many online tools to help you generate descriptive names for HEX codes, such as <a href="https://chir.ag/projects/name-that-color/#FF6050">Name That Color</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XM-EbCbgqxx84ZV_d7_HPw.png" /><figcaption>Examples of good and bad base colour names.</figcaption></figure><h4><strong>Derivative Colours</strong></h4><p>Some base colours are derivatives of the main base colours. These include colours used for specific states or specific purpose, such as:</p><ul><li><strong>Tapped state</strong> (slightly darker)</li><li><strong>Hover state</strong> (slightly lighter)</li><li><strong>Semitransparent colours </strong>(dividers)</li></ul><p>Assigning a unique name to each derivative colour can be time-consuming. More importantly, remembering the names of colour shades that are very similar to one another can be challenging. If two names are not visually intuitive, they fail to fulfill their primary purpose of being easy to identify and use.</p><p>Derivative colours can be simply named following the rules below.</p><h4>Creating Derivative Colours</h4><ol><li><strong>Tint</strong>: Lighter colours are produced by blending the original colour with pure white in a desired proportion. The name of a tint is created by appending a suffix consisting of the letter ‘<strong>t’</strong> followed by the numeric value representing the percentage of white in the blend.<br>For example, <strong>clementine_t20</strong> is a mix of 80% clementine and 20% white.</li><li><strong>Shade</strong>: Darker colours created similarly by blending the original colour with black. The suffix contains the letter ‘<strong>s</strong>’. For example, <strong>clementine_s20 </strong>is a mix of 80% clementine and 20% black.</li><li><strong>Semitransparent</strong>: Achieved by altering the alpha channel directly. The suffix contains the letter ‘<strong>a</strong>’. For example, <strong>black_a20 </strong>is black colour with 20% opacity.</li></ol><h3><strong>Semantic Colour Aliases</strong></h3><p>Semantic aliases are so named because their <strong>purpose is reflected in their names</strong>. These aliases derive their values by mapping to a base colour. Here are the key principles for naming semantic colour aliases:</p><ul><li>The purpose of a semantic alias should be easy to understand.</li><li>The name of each alias must be unique within the set of aliases.</li></ul><p>If you search online, you’ll find plenty of examples where people attempt to create overly complex naming systems. These systems often combine multiple parts — such as state, category, concept, variant, and property — into a single naming scheme. Some even add unnecessary prefixes, overuse delimiters, which only increases the length without adding any value.</p><p>While devising such universal systems may seem like an interesting and challenging task, it’s ultimately counterproductive.</p><p>The main rule is this: <strong>a naming system must make our everyday work easier, not harder.</strong> This principle aligns with the very reason we build design systems — to improve efficiency and collaboration.</p><p>Since designers are the primary users of the system, the naming must prioritise their convenience. Optimising names for developers at the expense of clarity for designers would be counterproductive. Designers should never have to struggle to understand the meaning of a name.</p><p>If developers need to use colour token automation tools, such as <em>style-dictionary</em>, they should handle any necessary conversions within the scripts, ensuring that the original colour names remain intact and designer-friendly.</p><p>The most practical way to name colour aliases follows two key principles:</p><ol><li><strong>Reverse-domain naming:</strong> Arrange components from generic to specific. For example: iconInfo, textPrimaryInverse.</li><li><strong>Be as concise as practicality allows.</strong></li></ol><p>These principles benefit both designers and engineers:</p><ul><li>Reverse-domain naming enables natural grouping, making it easier to locate an alias using Figma’s search function or code autocompletion in development.</li><li>Concise names ensure that aliases fit comfortably in Figma inspectors or variable tables.</li></ul><h3>Name Parts</h3><p>A colour alias name consists of multiple parts, with each part representing a specific <strong>concept</strong>. By identifying the concepts and arranging them in the correct order, you create the name.</p><p>The key concepts are:</p><ul><li><strong>Purpose Group</strong>: What the colour is used for.</li><li><strong>Differentiator</strong>: A way to distinguish between colours with the same purpose group.</li><li><strong>Interactive State</strong>: The interaction state of the element, such as <em>Normal</em>, <em>Hover</em>, <em>Pressed</em>, <em>Disabled</em>, <em>Focused</em>, or <em>Selected</em>.</li><li><strong>Inverse</strong>: Indicates the type of foreground-to-background contrast.</li></ul><p>These concepts should be thoroughly discussed, clearly understood, and well-documented to prevent misinterpretation or incorrect naming when new colours are added to the palette in the future.</p><h3>Purpose Group</h3><p>The first component of the name reflects the main purpose of the alias — that is, what the colour is used for.</p><p>Examples:</p><ul><li><strong>Icon</strong> in iconInfo</li><li><strong>Surface</strong> in surfaceBase</li><li><strong>InteractiveBackground</strong> in interactiveBackgroundNormal</li><li><strong>Text</strong> in textCritical</li></ul><p>In each case, the name begins with the primary purpose of the colour — <em>icon</em>, <em>surface</em>, <em>interactiveBackground</em>, or <em>text</em>. This structure creates a natural grouping of colours within the same category, making it easier to organise and use.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*og7gRwhlBbhoNP58eubczA.png" /></figure><p>Purpose group is the only compulsory name part. Other parts may be added only if required.</p><h4>Differentiator</h4><p>When a group of aliases shares the same purpose group, a differentiator is needed to distinguish between them.</p><p>For example, in the set of aliases textPrimary, textSecondary, and textCritical, the differentiators are <em>primary</em>, <em>secondary</em>, and <em>critical</em>. These terms help clarify the distinct roles of each alias within the group. We’ll explore these differentiators in more detail later.</p><p>If a group contains only one member, a differentiator is not needed. For example, design systems often use just one color for dividers, so divider can serve as the sole member of its group without requiring further distinction.</p><h4>Interactive State</h4><p>Interactive states are typically represented by changes in color. Common states include <em>Normal</em>, <em>Hover</em>, <em>Pressed</em>, <em>Disabled</em>, <em>Focused</em>, and <em>Selected</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xaouOMznCBaLJVhoZJxmHw.png" /></figure><p>For example, the aliases interactiveForegroundNormal, interactiveForegroundPressed, and interactiveForegroundDisabled include the state as part of their names, clearly indicating their specific role in the user interface.</p><p>Interactive State part applies only to interactive group of colours.</p><p>The foreground differentiator here serves as an aggregation of text , border and possibly icon simply to reduce the number of aliases. This is, of course, given that the designer wants those elements be the same colour.</p><h4><strong>Inverse</strong></h4><p>Inverse contrast refers to light elements (foreground) displayed over a dark background, as opposed to the regular (non-inverse) contrast of dark elements over a light background.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v1hp692kjHxT2lWcwgi8rQ.png" /></figure><p>With respect to static text aliases a common example would be:<br>textPrimaryInverse (inverse) vs. textPrimary (non-inverse).</p><p>Non-inverse colours do not include a suffix, as they represent the regular contrast scenario. The majority of color aliases in a design system are non-inverse.</p><h3>Implementation</h3><p>With the naming sorted, let’s move on to the implementation details for colors. We’ll explore examples in Figma and iOS code.</p><h4>Figma</h4><p>Since the introduction of Local Variables in Figma, implementing a two-layered color system has become much simpler.</p><p>To start, create two separate collections of Local Variables: one for Base Colors and another for Aliases.</p><p><strong>Base Collection</strong></p><p>For the Base collection, you can create base color variables by simply assigning a name and hex code to each variable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TSFUrUfdJWxQu-TMuzW7Tg.png" /><figcaption>Base colours in the Local Variables collection</figcaption></figure><p><strong>Aliases Collection</strong></p><p>Next, open the Aliases collection and start creating semantic aliases. To link an alias to a base color, follow these steps:</p><ol><li>Open the <strong>Libraries</strong> tab in the color picker dialog.</li><li>Search for the name of the base color you want to reference.</li><li>Select the desired base color to establish the link between the alias and the base layer.</li></ol><p>This approach ensures that your aliases are dynamically tied to the base colours, making future updates seamless and efficient.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FNMveRU6zgwYlfYX-ASbeA.png" /></figure><p>Each colour alias variable can be mapped to different base colours depending on the mode. For example, in the image above, we have two modes: Light and Dark. Additionally, this approach allows you to create different branding variations by assigning different base colours to aliases for each branding context. Once you start using the aliases on elements, you will be able to switch the mode either on the element itself or on its container.</p><p>To organise your aliases further, you can group colour aliases by prefixing the name of the variable with the group name. Alternatively, drag and drop a variable into an existing group to assign it.</p><h4>iOS</h4><p>The best way to implement base colours in iOS is by creating a static variable within a private extension on UIColor.</p><pre>extension UIColor {<br>    static let white = UIColor(hex: 0xFFFFFF)<br>    static let ice = UIColor(hex: 0xF2FBFE)<br>    static let black_a20 = UIColor(hex: 0x000000, alpha: 0.20)<br>    ...<br>}</pre><p>Developers will need to write a custom function to convert a hex code into a UIColor instance. Since base colours are never referenced directly in the application, there’s no need to convert UIColor to SwiftUI.Color.</p><p>The best way to implement colour aliases is by creating a static variable within a public extension on UIColor.</p><pre>public extension UIColor {<br>    // Text<br>    static var textPrimary = UIColor(lightMode: .crow, darkMode: .ice)<br>    static var textPrimaryInverse = UIColor(lightMode: .white, darkMode: .ice)<br>    ...<br>}</pre><p>Developers will need to implement a custom function to resolve the mapping between two base colours based on the current interface style — dark or light — retrieved from the current trait collection.</p><p>Finally, SwiftUI elements can be provided with the appropriate colours by converting them from UIColor instances.</p><pre>public extension Color {<br>    static let textPrimary = Color(UIColor.textPrimary)<br>    ...<br>}</pre><p>It may seem redundant to implement UIColor instances first and then convert them to SwiftUI Color instances afterward. However, this approach offers greater flexibility.</p><p>In some cases, you may need direct access to a UIColor instance, such as when configuring an appearance selector. Other scenarios might require converting a colour to CGColor or accessing its red, green, or blue components. Unlike SwiftUI Color, which lacks these capabilities, UIColor provides the versatility necessary to meet these requirements.</p><h3>Conclusion</h3><p>I hope this article helps you set up the colour foundation in your design system, both in Figma and in code. Having a consistent naming system will enable easy extensions and modifications. Additionally, supporting Dark Mode or multiple branding variations becomes much simpler.</p><p>Please let me know if this article was helpful or if there are other aspects of colour system naming you’d like me to cover.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dcb05be4b9af" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Design system from scratch: spacing]]></title>
            <link>https://medium.com/design-bootcamp/design-system-from-scratch-part-2-spacing-7f8b815cd038?source=rss-bde649bd90e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/7f8b815cd038</guid>
            <category><![CDATA[scale]]></category>
            <category><![CDATA[design-systems]]></category>
            <category><![CDATA[naming-conventions]]></category>
            <category><![CDATA[ui-design]]></category>
            <category><![CDATA[spacing]]></category>
            <dc:creator><![CDATA[Davyd Geyl]]></dc:creator>
            <pubDate>Tue, 19 Oct 2021 11:39:02 GMT</pubDate>
            <atom:updated>2021-10-20T03:17:42.932Z</atom:updated>
            <content:encoded><![CDATA[<p>This is the second article in the series. The first one was on <a href="https://medium.com/@davyd.geyl/design-system-from-scratch-part-1-colours-17cf4850996d">Colours</a>.</p><h3>Spacing</h3><p>Having a spacing system is essential for a consistent and harmonious user interface. A well-implemented spacing system enables rapid design, handover and development.</p><p>Spacing is as omnipresent as colour. Naturally, a design system must develop the Spacing foundation right after the <a href="https://bootcamp.uxdesign.cc/design-system-from-scratch-part-1-colours-17cf4850996d">Colour foundation</a>.</p><p>Clear naming of the spacing elements is essential for design and handover. Both designers and developers need to adopt one naming system and keep it consistent across all platforms.</p><h4>Units</h4><p>In essence, “spacing” is an empty space or a <strong>distance</strong> between two visual elements. The numerical representation of this distance depends on the measurement units.</p><p>Different platforms use different units to measure the distance in graphical user interfaces. iOS uses points — <strong>pt</strong>. Android uses <strong>dp</strong> and <strong>sp</strong>. In web CSS pixels are used — <strong>px</strong> (not to be confused with physical pixels). Sketch doesn’t name them at all — they are just numeric values.</p><p>On a physical screen, all those different units end up being converted into physical pixels. On top of that, different displays have different densities or the number of physical pixels per mm or per inch.</p><p>Since we design for different platforms, what we really need to know is whether a particular element will be of the same size on different physical screens.</p><p>For example. If we draw a rectangle in Sketch 100 x 100 units, code it as 100pt in iOS, 100dp in Android and 100px in Web. Would this element have the same physical width when rendered on three different physical screens?</p><p>Without going into details, no, not exactly the same, but it is practically the same. The difference in physical size is negligible.</p><p>This is certainly good news because we can adopt one measurement unit for all three platforms. We call the spacing measurement units “points”.</p><h4>Base spacing</h4><p>One point is quite small. For practical applications, we adopt a base unit and build a harmonious scale from it.</p><p>Our base spacing unit equals 8 points. Other spacing elements are multiples of the base unit.</p><p>base = 8 points (pt/dp/px)</p><p><strong>spacing1x = </strong>base</p><p><strong>spacing2x</strong> = base * 2</p><p><strong>spacing3x</strong> = base * 3</p><p>The horizontal spacing scale includes multipliers such as half, 1, 2, 3, 4, 5, 8 and 12.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tb3oL8O0b5166neupbCVgQ.png" /><figcaption>Horizontal spacing scale</figcaption></figure><p>The vertical scale may require more precision than the horizontal one. We have additional <strong>spacing1nHalf</strong><em>.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MGM1bPEy-cN-cFgqoFbnLQ.png" /><figcaption>Vertical spacing scale</figcaption></figure><p>Your design system may have a different base unit and scale.</p><h4>Sketch symbols</h4><p>Spacings are implemented in Sketch as a set of custom symbols, which we keep in the Foundations library.</p><p>Spacing symbols allow designers to speed up the workflow by utilising the snapping behaviour in Sketch. It’s quick and easy to add spacing symbols to the artboard, snap them to the sides, snap other pattern symbols to the spacing symbols and so on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d0U6dii45jhGYmTxmidKPA.png" /><figcaption>Horizontal and vertical spacings symbols in use.</figcaption></figure><p>Also, the spacing symbols developed this way are used in the handover. They are self-explanatory. Developers know that the number on the spacing symbol means the multiplier of the base unit. So, in code, they will use <strong>spacing3x</strong> for the left and right margins, <strong>spacing2x</strong> for the top and <strong>spacing1x</strong> for the bottom margins of the text label.</p><p>Spacing symbols must stretch only in one direction. For example, all horizontal spacing symbols can only be stretched vertically while keeping their width fixed. Unfortunately, Sketch doesn’t allow to fix the size of a symbol. However, the internal visible part of the symbol can have a fixed size. If you stretch the symbol in wrong direction you will see that the visible part doesn’t follow the frame, so you can revert the change.</p><p>To hide or show all spacing symbols quickly we use our custom Sketch plugin. The clean design is used in handover too.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Aw2dtt9F6pgEkwjLZ3qP4Q.png" /><figcaption>Clean design with hidden spacing symbols.</figcaption></figure><h4>Android</h4><p>Spacing values can be defined in the dimensions resource file.</p><h4>iOS</h4><p>Since, the autolayout uses CGFoat type in the constraints, a set of static constants defined on CGFloat type in an extension works well.</p><h4>Web</h4><p>Depending on the chosen framework the implementation may vary. One agnostic way to implement spacings in Web is to use Sass functions.</p><h4>Aliases</h4><p>Unlike <a href="https://bootcamp.uxdesign.cc/design-system-from-scratch-part-1-colours-17cf4850996d">Colour aliases</a>, that are critical for the system, spacing semantic aliases are less common. Examples of spacing aliases may include left and right margins in mobile rows. They tend to be the same accross the entire application. Many different rows are likely to reuse the same one, so it’s a good cadidate for a semantic alias. The mechanism is the same: a semantic alias points to the basic spacing element.</p><blockquote><strong>marginRowHorizontal</strong> = <strong>spacing3x</strong></blockquote><p>The alias is used in the specs and code across different components.</p><h3>Summary</h3><p>The Spacing foundation of a design system consists of a naming convention, a base unit and a scale of basic spacings, spacing symbols in the graphical design tool, constants in code across all platforms. Such a system enables rapid design, handover and development.</p><p>Next time we are going to look at the Font foundation.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7f8b815cd038" width="1" height="1" alt=""><hr><p><a href="https://medium.com/design-bootcamp/design-system-from-scratch-part-2-spacing-7f8b815cd038">Design system from scratch: spacing</a> was originally published in <a href="https://medium.com/design-bootcamp">Bootcamp</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Design System from scratch. Part 1 — Colours.]]></title>
            <link>https://medium.com/design-bootcamp/design-system-from-scratch-part-1-colours-17cf4850996d?source=rss-bde649bd90e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/17cf4850996d</guid>
            <category><![CDATA[design-systems]]></category>
            <category><![CDATA[gui]]></category>
            <category><![CDATA[colour]]></category>
            <category><![CDATA[palette]]></category>
            <category><![CDATA[design]]></category>
            <dc:creator><![CDATA[Davyd Geyl]]></dc:creator>
            <pubDate>Sun, 29 Aug 2021 10:31:43 GMT</pubDate>
            <atom:updated>2021-12-07T01:07:56.014Z</atom:updated>
            <content:encoded><![CDATA[<h3>Design System from scratch: colours</h3><p>Here starts a series of articles on how to build a design system from scratch. If your team is building one, I hope this material will help you to make it better. Perhaps you can even avoid making some fatal mistakes.</p><p>For the last four years, I have led the creation of two successful design systems. The first one was in the number one Australian bank. The second is in the largest telco — Telstra. Both times I was fortunate to work with the best software designers and developers in the industry. I, myself, have been a passionate software engineer and designer for more than two decades. So, this series of articles is a distillation of the experiences of a good dozen of experts. I hope you will find it practical and inspiring.</p><p>There is lots of talk about design systems lately and plenty of material online. However, I am going to share my own experience, based on practical results of many years. Also, I am going to share my personal view on what works and what doesn’t.</p><h3>Colours</h3><p>Every element of a Graphical User Interface needs colours. Also, the colour palette is an important part of any large company’s brand style guide. So, a design system has no choice but to start with the Colour <strong>foundation</strong>.</p><blockquote><strong><em>Foundations</em></strong><em> — are the building blocks of a graphical user interface. All patterns in a design system consist of them. Foundations include colour, font, spacing, icons, grid and a few others.</em></blockquote><h4>Colour Palette</h4><p>The first problem we need to solve is to define our <strong>finite</strong> colour palette. What this means is that we need to get our colours under control.</p><p>A colour palette usually consists of brand colours, utility colours and neutral colours. Accessibility considerations impose certain limitations on the foreground and background colour combinations. We may spend some time refining our colour palette. There is no need to rush. A well-defined colour palette will provide a good foundation for our design system. A sloppy colour palette may endanger the future of the whole system.</p><p>Suppose we know which colours we need. How do we refer to them? How do we document, implement and use them across the company?</p><h4>The Problem</h4><p>The user interface is usually designed and implemented by different people. The need to have a system in place becomes apparent in the following simplified handover example.</p><p>Suppose a designer draws an element of a user interface and hands it over to a developer. How do they specify the colour? It’s common to use a HEX code for handover.</p><figure><img alt="HEC colour is handed over from design to development" src="https://cdn-images-1.medium.com/max/1024/1*A84tbnJHprQ7nvW8Jxc7hw.png" /></figure><p>What would a developer do with this HEX code? They would add it to the code base.</p><figure><img alt="HEX code is hardcoded into the codebase." src="https://cdn-images-1.medium.com/max/1024/1*bQXhNrmrkqXHu4SDcRwwWg.png" /></figure><p>That was easy. However, ease comes with consequence.</p><p>If the team keeps designing and developing the software this way, before long the code base will be filled up with lots of hardcoded values in many different places.</p><figure><img alt="Many hardcoded HEX codes in the codebase." src="https://cdn-images-1.medium.com/max/1024/1*hgbcjnJOgSQmToR9gJS6cA.png" /></figure><p>This would be the result of the work of a single team. Large companies have dozens of teams working on the same product. So, in a large company, the picture would look even worse.</p><figure><img alt="Many teams hardcoded many HEX colours in the codebase." src="https://cdn-images-1.medium.com/max/1024/1*a5VLc1G7jF8pEXGPZq6hjw.png" /></figure><p>By the way, if you haven’t noticed that some of the HEX codes in those pictures are different from the others, I don’t blame you. It’s difficult for a human to pick up differences in HEX code at a glance as opposed to a computer.</p><p>Now, this is just one colour — so if you multiply it by the number of colours in the pallete, you’ll be able to imagine the scale of the problem.</p><p>If you are fortunate to have diligent developers, they will name the colour constants and reuse them. Even then, the scope of this improvement will be limited by one application, one discipline (Android, iOS, Web) or one project. Large companies usually have dozens of designers and developers. They develop products for multiple platforms, such as Android, iOS and Web. They have multiple projects in development on each platform at the same time. Under these circumstances, the only way to avoid a mess is to have a company-wide system.</p><p>How can we design a colour system that everyone in the company can use?</p><h4>HEX codes - pros and cons</h4><p>We need colours in the design files, for the handover and in the development. Using only HEX codes to handle colours has benefits and downsides. Let’s start with the advantages.</p><ol><li>It’s easy to look them up in the graphic editor and hardcode them.</li></ol><p>As far as I know, there are no other advantages. Let’s look at the downsides.</p><ol><li>HEX codes are not suitable for everyday conversations. When two designers need to talk about a particular colour, what would they say? Saying “twenty-four, sixty-seven, bee three” is not practical. Also, HEX codes are too difficult to remember.</li><li>Difficult to visualise. If you hear “twenty-four, sixty-seven, bee three”, which colour comes to mind? Few people can remember the HEX code. What is easy for a computer is not easy for a person.</li><li>Difficult to maintain. Sooner or later, some colours will need to be changed. Usually, that happens because of brand changes or changes to accessibility requirements. Looking for all those hardcoded values scattered across many design and code files will be very difficult. Even more so, if there is no single source of truth and we are not particularly sure what to look for.</li><li>Unrestricted colour palettes lead to inconsistencies. Heaps of similarly looking yet differently defined colours may accumulate across design files and code bases. As a result, the look of our digital products may appear off-brand. Some loosely defined colours may create problems with accessibility colour contrast requirements.</li><li>They are not future-proof. Uplift of some types of user interface elements while leaving the rest untouched will be challenging. It will require a lot of manual work to review each particular hardcoded colour instance.</li><li>Don’t provide any usage directions. HEX codes won’t help new designers with understanding how to use these colours.</li><li>UI element rigidly mapped to one colour won’t allow supporting Dark Mode or High Contrast colour schemes.</li></ol><p>Clearly, the disadvantages of this approach far outweigh the advantages.</p><h4>Named colours</h4><p>A logical way to overcome the problems listed above is to name all our colours.</p><figure><img alt="White, crow, and success names represent white, dark gray and green colours." src="https://cdn-images-1.medium.com/max/1024/1*1X07fhre_lRzwpnQmjX-3A.png" /></figure><p>Named colours solve some problems. Two people speaking about colours as ‘<strong>white</strong>’ or ‘<strong>crow</strong>’ will understand each other. Even such a name as ‘<strong>success</strong>’ will be easier to use compared to a HEX code. However, some of the problems remain unsolved.</p><h4>Colour name flexibility</h4><p>Future-proofing is somewhat expected from a system that is supposed to last.</p><p>The flexibility of a colour name may vary from a very concrete rigid name such as ‘<strong>white</strong>’ or ‘<strong>black</strong>’ to a very flexible name such as ‘<strong>lambda</strong>’.</p><figure><img alt="White, crow, success, text primary and lambda colour names on the linear axis spanning from the very rigid on the left to the very flexible on the right." src="https://cdn-images-1.medium.com/max/1024/1*jokkJFkVJTzJW21mU2gYmw.png" /></figure><p>The rigid colour name ‘<strong>white</strong>’ can never represent any other colour apart from white. The flexible colour name ‘<strong>lambda</strong>’ can denote any colour on the spectrum. It may appear green today and red tomorrow. Between these two extremes, any degree of flexibility is possible. Such a name as ‘<strong>crow</strong>’ can represent a handful of very dark grey colours. ‘<strong>Success</strong>’ would most likely lean towards the green part of the spectrum.</p><p>Although rigid colours are easy to visualise and refer to, they are not future proof. On the other hand, flexible colours allow future updates, but they are difficult to visualise, and may be difficult to reference.</p><p>There is one more aspect to consider: usage directions.</p><h4>Usage directions</h4><p>Rigid colour names fundamentally lack usage directions. Flexible colours have the potential to provide usage directions. Let’s introduce the second dimension to our colour naming space.</p><figure><img alt="Second dimension is introduced. The vertical axis indicated a measure of usage direction from no direction at the bottom to semantic usage direction at the top. The colours white, crow, success, text primary and lambda moved in vertical dimenson. Text primary sits in the upper right quadrant. It’s future proof and has usage directions.  The white and crow colours are in the left bottom quadrant. They are easy to visualise and easy to use." src="https://cdn-images-1.medium.com/max/1024/1*kqit_L_iGBetyihkMcpr3A.png" /></figure><p>Note how the desired attributes of the colour names are in two opposite quadrants.</p><p>We want our colour names to be:</p><ol><li>Easy to visualise,</li><li>Easy to refer to,</li><li>Future proof,</li><li>Provide usage directions.</li></ol><p>Unfortunately, one colour name can’t satisfy all these requirements. We either have to compromise or find a better solution.</p><h4>Two-layered colour system</h4><p>We can have the best from both sides by using the two-layered colour system:</p><ol><li>The top layer of semantic colour aliases.</li><li>The bottom layer of base colours.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BPskOKlV0cOK9c5JXhA8PA.png" /><figcaption>Two-layered colour system</figcaption></figure><h4>Base colours</h4><blockquote>Base colour names only tell us what those colours look like. Their purpose is to provide a human-readable, easy-to-visualise description of the colour.</blockquote><p>Examples of good base colour names include: ‘<strong>emerald</strong>’, ‘<strong>lavender</strong>’ or ‘<strong>crow</strong>’.</p><p>The base colours must never be used directly for handover nor should they be assigned to the properties of UI elements in code.</p><p>Designers can use base colours in draft designs. However, only semantic colour aliases can be handed over to the developers and assigned to the properties of the UI elements in code.</p><h4>Aliases</h4><p>We call them ‘aliases’ to reflect their dependent nature, i.e. they always represent base colours.</p><p>Examples of good colour alias names include: ‘<strong>textPrimary</strong><em>’</em>, ‘<strong>foregroundInteractiveNormal</strong><em>’</em>, ‘<strong>backgroundInteractivePressed</strong><em>’</em>.</p><blockquote>The name of a semantic colour alias only tells us what this alias is for. The purpose of this name is to provide a clear usage direction of the colour alias.</blockquote><p>This set of colour aliases is our public colour system. Designers must specify and handover only colour aliases. Developers must use colour aliases to assign to the properties UI elements in code. Under no circumstances use a HEX code or a base colour.</p><h4>Dark Mode</h4><p>It’s easy to implement Dark Mode with a two-layered colour system. All we need is to define an additional mapping of each colour alias to a Dark Mode base colour.</p><p>In this example, ‘<strong>textPrimary</strong>’ is mapped to the ‘<strong>crow’</strong> base colour in Light Mode and the ‘<strong>ice’</strong> base colour in Dark Mode.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jNbzFnhhxZcLgoXF06mCMA.png" /></figure><p>Every colour alias now is mapped to a pair of base colours. In the application, the mapping is dynamically resolved based on the current mode in runtime.</p><h4>Inverse colours</h4><p>Dark Mode is about having light content on dark backgrounds. However, some parts of your designs may have light content on dark background in Light Mode too.</p><blockquote>The set of light foreground colour aliases and dark background colour aliases designed for Light Mode is called <strong>inverse colours</strong>.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bx6_sXvqJHAkWTFaRPRUrw.png" /></figure><p>Since Dark Mode is not a simple inversion of every Light Mode colour, inverse colours don’t need to be inverted again. We can either keep an inverse colour alias mapped to the same base colour in Dark Mode or map it to another one.</p><p>Keep in mind that pure white content may cause eye strain when used on a very dark background. In the example above, ‘<strong>textPrimaryInverse’</strong> is mapped the base colour ‘<strong>ice</strong>’, which is slightly darker than white.</p><h4>Source of truth</h4><p>A design system in general and colours in particular need to be used both by designers and developers. Also, we have developers working on different platforms: Android, iOS and Web. While the implementation of the colour system is different in each case, the source of truth must be only one. We use Confluence for that.</p><p>The colour system must be defined in one place that is easily accessible by everyone in the company. The values and the names of each base colour and each alias in graphical tools and code must match the definition.</p><h4>Implementation</h4><p>The first implementation of the colour system will be in the graphical editor of your choice. For example, in Sketch the base colours may be defined as colour variables and layer styles. These can be used for experimental designs.</p><p>Unfortunately, Sketch doesn’t have a mechanism to support colour aliases. Colour aliases can be implemented as layer styles too.</p><p>In iOS, the colour aliases may be implemented as public class variables in a UIColour category and mapped to the base colours in runtime depending on the current mode. Base colours may be implemented as private constants.</p><p>Alternatively, in iOS, the colour aliases may be implemented in an asset catalogue as colour sets. The base colours will be set as HEX codes without the use of their names. This method allows automatic resolution of the light and dark mode mapping. However, it slightly complicates the maintainability of the colour aliases. If the base colour’s value needs to be changed it will require a manual change of every dependent colour alias. In practice, such updates happen rarely, so they wouldn’t have a significant impact on productivity.</p><p>In Android, the base colours can be defined in one resource file. The colour aliases can be defined in two other resource files: one for the day mode, another one for the night mode. Making the base colours private may be problematic.</p><p>In Web, the colours can be implemented as Sass variables and map functions. Large companies may use different web platforms and third-party libraries for multiple projects. Web engineers need to find the most agnostic implementation method, so the design system foundations are available for all projects.</p><p>Here is an example of the documentation from the design system created for the DiveBud startup.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TeZKY71J_yt-GMZEA93dHA.png" /><figcaption>Base colours documentation</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vtxvbSl-FDRXhfD8zqGKEA.png" /><figcaption>Colour aliases documentation.</figcaption></figure><h4>Maintenance</h4><p>After the first version colour system is implemented, the documentation must be locked to protect the system from undesired changes. All future updates of the colour system will need to be versioned and rolled out in a controlled fashion.</p><p>For example, we need to add one more base colour and two more colour aliases. We make a new version of the documentation page. Implement it in all channels: Sketch, Android, iOS, Web. Then we roll out the updates at the same time and announce the change.</p><h4>Summary</h4><p>The two-layered colour system is simple enough to implement and maintain, yet sophisticated enough to satisfy all the requirements we have discussed. It allows us to create a set of colour names suitable for a large production environment focused on making consistent graphical user interfaces.</p><p>Next time we are going to look at the <a href="https://medium.com/@davyd.geyl/design-system-from-scratch-part-2-spacing-7f8b815cd038">Spacing foundation.</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=17cf4850996d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/design-bootcamp/design-system-from-scratch-part-1-colours-17cf4850996d">Design System from scratch. Part 1 — Colours.</a> was originally published in <a href="https://medium.com/design-bootcamp">Bootcamp</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>