<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet href="/feed.xsl" type="text/xsl" ?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en" xml:base="https://chrisburnell.com">
	<title>Chris Burnell – Latest Posts</title>
	<subtitle>Latest 10 posts from the blog. You can also browse hot pages and popular pages.</subtitle>
	<id>https://chrisburnell.com/</id>
	<link href="https://chrisburnell.com/feed.xml" rel="self" />
	<link href="https://chrisburnell.com/" rel="alternate" />
	<author>
		<name>Chris Burnell</name>
		<uri>https://chrisburnell.com/</uri>
		<email>me@chrisburnell.com</email>
	</author>
	<logo>https://chrisburnell.com/images/raven.svg</logo>
	<image>https://chrisburnell.com/images/avatar@4x.jpeg</image>
	<updated>2024-01-18T11:45:00Z</updated>
	<generator>Eleventy v3.0.0</generator>
	<entry>
		<id>https://chrisburnell.com/article/prometheus/</id>
		<link href="https://chrisburnell.com/article/prometheus/" />
		<title>Prometheus</title>
		<published>2024-01-18T19:45:00+08:00</published>
		<updated>2024-01-18T19:45:00+08:00</updated>
		<category term="article" scheme="https://chrisburnell.com/article/" label="Article" />
		<summary>Reflecting on what striving for success has meant to me over the years until today.</summary>
		<content type="html">
			&lt;p&gt;Thinking back on the time that my Mum gave me the first six &lt;a href=&quot;https://abookapart.com&quot;&gt;A Book Apart&lt;/a&gt; books as a gift when I first left Canada to start my career in the UK in 2011. They meant so, so much to me. Not just for the enlightening words within, but also because they were this tangible thing that reminded me of the encouragement from my very academic family to take on the daunting task of “making it on my own” without a degree.&lt;/p&gt;
&lt;p&gt;Those books inspired the hell out of me. I treated the words inside like gospel. I immersed myself in front end and the web and worked hard to become really good at my craft. Little did I know that, in time, not only would I get to meet some of these accomplished authors, but they would actually know who &lt;em&gt;I&lt;/em&gt; was too. I had dreams of getting to finally meet them—heroes in my eyes—to totally fanboy out and get their autographs on the inside covers.&lt;/p&gt;
&lt;p&gt;A few months later, I landed my first proper gig in the industry as a Front End Developer. I almost couldn’t believe it. I did it. It was really happening.&lt;/p&gt;
&lt;p&gt;Boy, did I learn a lot in those first few months. It felt like that scene in The Matrix where Neo is learning a new martial art every minute. I was also extremely lucky to work with some truly talented, patient, and kind designers and developers, many of whom I still consider great friends today.&lt;/p&gt;
&lt;p&gt;A short time passed, and my young and naïve self, wanting to share all the incredible stuff I had learned, brought the books into work.&lt;/p&gt;
&lt;p&gt;That same afternoon, I went to make a coffee in the kitchen, and when I came back, the books were gone from my desk. No one admitted to taking them, and I never saw them again. It broke my heart and made my blood boil.&lt;/p&gt;
&lt;p&gt;Still does.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;Here I am now, 12 years later, having recently moved from London to Singapore, and finding myself in a similar situation as before: facing the stupidly-scary task of trying to find success off the back of my own efforts. Of course, I know a lot more now than I did back then—or so I’d like to think!—but new environments have always been a true test of my resilience.&lt;/p&gt;
&lt;p&gt;Ever since those first few months in my first front end role, I’ve wanted to work in Developer Relations. It was never something that seemed to fit into where I was in my career or who I was as a person, despite my best efforts in every job and role I’ve had since then to &lt;em&gt;make&lt;/em&gt; it a part of my job, however small that part may have been. Whether it was organising short, weekly meetings to talk about interesting new technology, share fun and interesting things I’d found, or even just being a knowledgable voice pushing for better standards, accessibility practices, etc. I was always reaching for it.&lt;/p&gt;
&lt;p&gt;This time, though, I think I finally have the gumption and drive to make it happen. To not just reach for it but to leap halfway around the world and wrestle it into my hands. In fact, I’m determined and steadfast that I &lt;em&gt;will&lt;/em&gt; find success, once again, no matter the challenges and doubt that I’ll face along the way.&lt;/p&gt;
&lt;p&gt;I guess I owe it to myself to order new copies of the books that I lost and fulfil that fanboy dream of mine from 12 years ago. Hopefully once I’ve found my way here in Singapore and built up some steam, I can make my way back for a short visit (ideally around &lt;a href=&quot;https://stateofthebrowser.com&quot;&gt;State of the Browser&lt;/a&gt;) and see it through. It’ll be a reminder of the encouragement from &lt;em&gt;myself&lt;/em&gt; to persevere, believe in my success, and “make it on my own” all over again.&lt;/p&gt;

		</content>
		</entry>
	<entry>
		<id>https://chrisburnell.com/article/old-design-system-new-colors/</id>
		<link href="https://chrisburnell.com/article/old-design-system-new-colors/" />
		<title>Can you teach an old design system new colours?</title>
		<published>2023-12-23T13:00:00+08:00</published>
		<updated>2023-12-23T13:00:00+08:00</updated>
		<category term="article" scheme="https://chrisburnell.com/article/" label="Article" />
		<summary>Over the years, I’ve changed the colours used across my website a number of times, and I’m happy with what I have now, but what I’m going to talk about today are formats for defining colours and some recent behind-the-scenes changes I made to how I define colours on my website, making theming my website easier.</summary>
		<content type="html">
			&lt;h2&gt;Hexidecimal / RGB&lt;/h2&gt;
&lt;figure&gt;
    &lt;ul class=&quot; [ palette  thirds ] &quot;&gt;
        &lt;li style=&quot;background-color: #5f8aa6; color: #060606;&quot;&gt;
            &lt;div class=&quot; [ delta ] &quot;&gt;Raven&lt;/div&gt;
            &lt;pre style=&quot;font-size: var(--font-size-small-min)&quot;&gt;#5f8aa6&lt;/pre&gt;
        &lt;/li&gt;
        &lt;li style=&quot;background-color: #060606; color: #f9f9f9;&quot;&gt;
            &lt;div class=&quot; [ delta ] &quot;&gt;Thunder&lt;/div&gt;
            &lt;pre style=&quot;font-size: var(--font-size-small-min)&quot;&gt;#060606&lt;/pre&gt;
        &lt;/li&gt;
        &lt;li style=&quot;background-color: #f9f9f9; color: #060606;&quot;&gt;
            &lt;div class=&quot; [ delta ] &quot;&gt;Snowy&lt;/div&gt;
            &lt;pre style=&quot;font-size: var(--font-size-small-min)&quot;&gt;#f9f9f9&lt;/pre&gt;
        &lt;/li&gt;
    &lt;/ul&gt;
&lt;/figure&gt;
&lt;p&gt;For many years, my colours were defined in &lt;strong&gt;Hexidecimal&lt;/strong&gt; format, or &lt;strong&gt;Hex&lt;/strong&gt; as it’s commonly known as, which maps to the &lt;abbr class=&quot; [ strong ] &quot; title=&quot;Red, Green, Blue&quot;&gt;RGB&lt;/abbr&gt; colour model. This was essentially the de facto way of defining colours back when I started web development in 2008.&lt;/p&gt;
&lt;p&gt;But when it comes to &lt;em&gt;reading&lt;/em&gt; and &lt;em&gt;understanding&lt;/em&gt; Hex and RGB colours, it’s a bit more tricky, particularly when dealing with the hexidecimal numbering system.&lt;/p&gt;
&lt;p&gt;&lt;noscript&gt;&lt;p class=&quot; [ box  box--error ] &quot;&gt;Unfortunately, this demo requires JavaScript to function correctly!&lt;/p&gt;&lt;/noscript&gt;&lt;/p&gt;
&lt;form id=&quot;demo-hex&quot;&gt;
	&lt;fieldset&gt;
		&lt;label for=&quot;input-hex-red&quot; class=&quot; [ delta ] &quot;&gt;Red&lt;/label&gt;
		&lt;input id=&quot;input-hex-red&quot; type=&quot;range&quot; min=&quot;0&quot; max=&quot;255&quot; value=&quot;95&quot; style=&quot;inline-size: 100%; line-height: 3;&quot; /&gt;
	&lt;/fieldset&gt;
	&lt;fieldset&gt;
		&lt;label for=&quot;input-hex-green&quot; class=&quot; [ delta ] &quot;&gt;Green&lt;/label&gt;
		&lt;input id=&quot;input-hex-green&quot; type=&quot;range&quot; min=&quot;0&quot; max=&quot;255&quot; value=&quot;138&quot; style=&quot;inline-size: 100%; line-height: 3;&quot; /&gt;
	&lt;/fieldset&gt;
	&lt;fieldset&gt;
		&lt;label for=&quot;input-hex-blue&quot; class=&quot; [ delta ] &quot;&gt;Blue&lt;/label&gt;
		&lt;input id=&quot;input-hex-blue&quot; type=&quot;range&quot; min=&quot;0&quot; max=&quot;255&quot; value=&quot;166&quot; style=&quot;inline-size: 100%; line-height: 3;&quot; /&gt;
	&lt;/fieldset&gt;
&lt;/form&gt;
&lt;div id=&quot;output-hex&quot; class=&quot;output-color&quot; style=&quot;background-color: rgb(95, 138, 166);&quot;&gt;&lt;/div&gt;
&lt;p&gt;Using the sliders above, try to make &lt;code style=&quot;background-color: #b5f1fd; color: #060606; font-size: 1.25em;&quot;&gt;this blue&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Now try to make it &lt;code style=&quot;background-color: #f2a5f4; color: #060606; font-size: 1.25em;&quot;&gt;this pink&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;This is absolutely not an easy task! This is because all three values, in tandem, are responsible for controlling not just the hue, but also the saturation and the lightness of that hue. This makes authoring and reading Hex and RGB values difficult as it’s difficult to imagine how certain ratios and amounts of each value mix to produce a colour.&lt;/p&gt;
&lt;p&gt;RGB is an additive colour format. This means that, starting from black, we combine &lt;strong&gt;r&lt;/strong&gt;ed, &lt;strong&gt;g&lt;/strong&gt;reen, and &lt;strong&gt;b&lt;/strong&gt;lue together to create a colour, and the syntax we use when coding to define Hex/RGB colours follows this format: we have to provide a red, green, and blue value.&lt;/p&gt;
&lt;p&gt;These limitations, particularly in &lt;em&gt;creating&lt;/em&gt; (or &lt;em&gt;finding&lt;/em&gt;) colours, were probably a good thing for web development, as it spawned countless, incredible tools that presented Hex/RGB in ways that are generally easier to understand and manipulate for humans than manually adjusting RGB values. This almost-surely pushed the collective understanding of colour on the web further and helped ingratiate people towards alternative and newer formats for defining colour.&lt;/p&gt;
&lt;h2&gt;HSL&lt;/h2&gt;
&lt;figure&gt;
    &lt;ul class=&quot; [ palette  thirds ] &quot;&gt;
        &lt;li style=&quot;background-color: hsl(204 29% 51%); color: hsl(0 0% 2%);&quot;&gt;
            &lt;div class=&quot; [ delta ] &quot;&gt;Raven&lt;/div&gt;
            &lt;pre style=&quot;font-size: var(--font-size-small-min)&quot;&gt;hsl(204 29% 51%)&lt;/pre&gt;
        &lt;/li&gt;
        &lt;li style=&quot;background-color: hsl(0 0% 2%); color: hsl(0 0% 98%);&quot;&gt;
            &lt;div class=&quot; [ delta ] &quot;&gt;Thunder&lt;/div&gt;
            &lt;pre style=&quot;font-size: var(--font-size-small-min)&quot;&gt;hsl(0 0% 2%)&lt;/pre&gt;
        &lt;/li&gt;
        &lt;li style=&quot;background-color: hsl(0 0% 98%); color: hsl(0 0% 2%);&quot;&gt;
            &lt;div class=&quot; [ delta ] &quot;&gt;Snowy&lt;/div&gt;
            &lt;pre style=&quot;font-size: var(--font-size-small-min)&quot;&gt;hsl(0 0% 98%)&lt;/pre&gt;
        &lt;/li&gt;
    &lt;/ul&gt;
&lt;/figure&gt;
&lt;p&gt;Enter &lt;abbr class=&quot; [ strong ] &quot; title=&quot;Hue, Saturation, Lightness&quot;&gt;HSL&lt;/abbr&gt;. Coming from the world of Hex/RGB, it was immediately more-readable to me, where the values in the HSL syntax tell us: which direction in the colour wheel to point; how saturated (how &lt;em&gt;much&lt;/em&gt;) of that colour we want, and the lightness of the produced colour.&lt;/p&gt;
&lt;p&gt;It’s important to know that HSL uses the same sRGB colour space as Hex and RGB, it just provides different parameters for us as developers to achieve the same colours.&lt;/p&gt;
&lt;p&gt;&lt;noscript&gt;&lt;p class=&quot; [ box  box--error ] &quot;&gt;Unfortunately, this demo requires JavaScript to function correctly!&lt;/p&gt;&lt;/noscript&gt;&lt;/p&gt;
&lt;form id=&quot;demo-hsl&quot;&gt;
	&lt;fieldset&gt;
		&lt;label for=&quot;input-hsl-hue&quot; class=&quot; [ delta ] &quot;&gt;Hue&lt;/label&gt;
		&lt;input id=&quot;input-hsl-hue&quot; type=&quot;range&quot; min=&quot;0&quot; max=&quot;360&quot; value=&quot;204&quot; style=&quot;inline-size: 100%; line-height: 3;&quot; /&gt;
	&lt;/fieldset&gt;
	&lt;fieldset&gt;
		&lt;label for=&quot;input-hsl-saturation&quot; class=&quot; [ delta ] &quot;&gt;Saturation&lt;/label&gt;
		&lt;input id=&quot;input-hsl-saturation&quot; type=&quot;range&quot; min=&quot;0&quot; max=&quot;100&quot; value=&quot;29&quot; style=&quot;inline-size: 100%; line-height: 3;&quot; /&gt;
	&lt;/fieldset&gt;
	&lt;fieldset&gt;
		&lt;label for=&quot;input-hsl-lightness&quot; class=&quot; [ delta ] &quot;&gt;Lightness&lt;/label&gt;
		&lt;input id=&quot;input-hsl-lightness&quot; type=&quot;range&quot; min=&quot;0&quot; max=&quot;100&quot; value=&quot;51&quot; style=&quot;inline-size: 100%; line-height: 3;&quot; /&gt;
	&lt;/fieldset&gt;
&lt;/form&gt;
&lt;div id=&quot;output-hsl&quot; class=&quot;output-color&quot; style=&quot;background-color: hsl(204 29% 51%);&quot;&gt;&lt;/div&gt;
&lt;p&gt;Like before, using the sliders above, try to make &lt;code style=&quot;background-color: #b5f1fd; color: #060606; font-size: 1.25em;&quot;&gt;this blue&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Then try to make it &lt;code style=&quot;background-color: #f2a5f4; color: #060606; font-size: 1.25em;&quot;&gt;this pink&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;It may not necessarily be quicker to do, but the inputs that we get with HSL are certainly more intuitive to work with and comprehend than RGB’s. Importantly, it puts two of the ways that we typically describe colour with language, by a colour’s Hue and Lightness, as two of the colour format’s inputs (which, I &lt;em&gt;imagine&lt;/em&gt; maps to parts of the brain more easily than RGB). The third input, Saturation may not be immediately obvious, but can be understood by playing with its value.&lt;/p&gt;
&lt;h3&gt;Hue&lt;/h3&gt;
&lt;div class=&quot;rgb-hue-gradient&quot;&gt;&lt;/div&gt;
&lt;p&gt;In contrast to manipulating RGB values, finding the Hue of your target colour is much easier here; although, not perfect, it’s still not trivial to be able to remember how much rotation is required to find your target Hue.&lt;/p&gt;
&lt;p&gt;Setting the Saturation to 100% and Lightness to 50%, and then cycling through the values for Hue, from 0° to 360° will give you an idea of what colours look like in their most saturated and untinted/unshaded form.&lt;/p&gt;
&lt;h3&gt;Saturation&lt;/h3&gt;
&lt;div class=&quot;rgb-saturation-gradient&quot;&gt;&lt;/div&gt;
&lt;p&gt;Next is Saturation which dictates &lt;q&gt;how much&lt;/q&gt; of our given Hue we want.&lt;/p&gt;
&lt;p&gt;With any Hue, try setting the Lightness to 50%, and then cycling through the values for Saturation, from 0% to 100%. This will give you an idea of how the amount of Saturation we apply to Hue dictates how far away from being completely-greyscale we make the colour. You’ll also notice that when the Saturation is at 0%, it doesn’t matter what the Hue is anymore—given the same Lightness, an unsaturated Red Hue and an unsaturated Cyan Hue appear the same.&lt;/p&gt;
&lt;h3&gt;Lightness&lt;/h3&gt;
&lt;div class=&quot;rgb-lightness-gradient&quot;&gt;&lt;/div&gt;
&lt;p&gt;The easiest way for me to understand the Lightness value is to think of it like a slide between black and white. The midpoint at 50% mixes your colour with both black and white (so a grey colour that is perfectly between black and white). As you deviate away from the midpoint, your colour is mixed with either more black and less white (as Lightness decreases) or more white and less black (as Lightness increases), reaching a point of being pure black at 0% and pure white at 100%.&lt;/p&gt;
&lt;p&gt;You can see this effect no matter what the Hue and Saturation values are.&lt;/p&gt;
&lt;h2 id=&quot;problems-with-srgb&quot;&gt;Problems with the sRGB colour space&lt;/h2&gt;
&lt;h3&gt;Inconsistent perceived lightness&lt;/h3&gt;
&lt;div class=&quot;hsl-lightness-block&quot;&gt;&lt;/div&gt;
&lt;p&gt;While one of the parameters of an HSL colour is Lightness, you’ll find that there is a stark contrast in how we perceive the brightness of Hues around the wheel.&lt;/p&gt;
&lt;p&gt;Cyan and blue both have identical Saturation and Lightness values—only their Hues differ—but we perceive the cyan as being much brighter than the blue. We can account for this by changing Saturation and Lightness to compensate, but an ideal colour space would provide consistency in its parameters.&lt;/p&gt;
&lt;h3&gt;Dead grey zones&lt;/h3&gt;
&lt;div class=&quot;hsl-ugly-gradient&quot;&gt;&lt;/div&gt;
&lt;p&gt;A clear example of this is in displaying gradients; when instructing the browser to traverse the colour space to find a line between two colours that will make up the gradient, you’ll often find that it takes a path that you don’t expect or want. It’s not uncommon to find that developers have created gradients that don’t simply traverse from point A to point B in the colour space; they provide additional colour stops to ensure that the gradient looks correct.&lt;/p&gt;
&lt;p&gt;In the example, I’ve instructed the browser to create a gradient between red and cyan, but you’ll notice that it goes through a grey/monochrome area of the colour space around the midpoint. I would hope that the produced gradient would tween between not just the hues of red and cyan, but also their lightness and saturation. It seems, however, that the path taken to draw gradients often goes through parts of the sRGB colour space that have little or no saturation, leading to &lt;a href=&quot;https://www.smashingmagazine.com/2023/08/oklch-color-spaces-gamuts-css/#dead-grey-zones&quot;&gt;dead grey zones&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;OKLCH&lt;/h2&gt;
&lt;figure&gt;
    &lt;ul class=&quot; [ palette  thirds ] &quot;&gt;
        &lt;li style=&quot;background-color: oklch(61.29% 0.064 237.73); color: oklch(15% 0 0);&quot;&gt;
            &lt;div class=&quot; [ delta ] &quot;&gt;Raven&lt;/div&gt;
            &lt;pre style=&quot;font-size: var(--font-size-small-min)&quot;&gt;oklch(61.29% 0.064 237.73)&lt;/pre&gt;
        &lt;/li&gt;
        &lt;li style=&quot;background-color: oklch(15% 0 0); color: oklch(98.2% 0 0);&quot;&gt;
            &lt;div class=&quot; [ delta ] &quot;&gt;Thunder&lt;/div&gt;
            &lt;pre style=&quot;font-size: var(--font-size-small-min)&quot;&gt;oklch(15% 0 0)&lt;/pre&gt;
        &lt;/li&gt;
        &lt;li style=&quot;background-color: oklch(98.2% 0 0); color: oklch(15% 0 0);&quot;&gt;
            &lt;div class=&quot; [ delta ] &quot;&gt;Snowy&lt;/div&gt;
            &lt;pre style=&quot;font-size: var(--font-size-small-min)&quot;&gt;oklch(98.2% 0 0)&lt;/pre&gt;
        &lt;/li&gt;
    &lt;/ul&gt;
&lt;/figure&gt;
&lt;p&gt;And finally, where I’ve happily landed: &lt;strong&gt;OKLCH&lt;/strong&gt;. This is the most flexible and understandable colour format that I’ve &lt;a href=&quot;/feature-watch/&quot;&gt;found&lt;/a&gt;, but do check out &lt;a href=&quot;https://drafts.csswg.org/css-color/#predefined&quot;&gt;the list of predfined colour spaces in the CSS Color Specifications&lt;/a&gt; for all the possibilities.&lt;/p&gt;
&lt;p&gt;&lt;noscript&gt;&lt;p class=&quot; [ box  box--error ] &quot;&gt;Unfortunately, this demo requires JavaScript to function correctly!&lt;/p&gt;&lt;/noscript&gt;&lt;/p&gt;
&lt;form id=&quot;demo-oklch&quot;&gt;
	&lt;fieldset&gt;
		&lt;label for=&quot;input-oklch-lightness&quot; class=&quot; [ delta ] &quot;&gt;Lightness&lt;/label&gt;
		&lt;input id=&quot;input-oklch-lightness&quot; type=&quot;range&quot; min=&quot;0&quot; max=&quot;100&quot; value=&quot;61&quot; style=&quot;inline-size: 100%; line-height: 3;&quot; /&gt;
	&lt;/fieldset&gt;
	&lt;fieldset&gt;
		&lt;label for=&quot;input-oklch-chroma&quot; class=&quot; [ delta ] &quot;&gt;Chroma&lt;/label&gt;
		&lt;input id=&quot;input-oklch-chroma&quot; type=&quot;range&quot; min=&quot;0&quot; max=&quot;0.4&quot; value=&quot;0.06&quot; step=&quot;0.01&quot; style=&quot;inline-size: 100%; line-height: 3;&quot; /&gt;
	&lt;/fieldset&gt;
	&lt;fieldset&gt;
		&lt;label for=&quot;input-oklch-hue&quot; class=&quot; [ delta ] &quot;&gt;Hue&lt;/label&gt;
		&lt;input id=&quot;input-oklch-hue&quot; type=&quot;range&quot; min=&quot;0&quot; max=&quot;360&quot; value=&quot;238&quot; style=&quot;inline-size: 100%; line-height: 3;&quot; /&gt;
	&lt;/fieldset&gt;
&lt;/form&gt;
&lt;div id=&quot;output-oklch&quot; class=&quot;output-color&quot; style=&quot;background-color: oklch(61.29% 0.064 237.73);&quot;&gt;&lt;/div&gt;
&lt;p&gt;Last time now, using the sliders above, try to make &lt;code style=&quot;background-color: #b5f1fd; color: #060606; font-size: 1.25em;&quot;&gt;this blue&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Finally, try to make it &lt;code style=&quot;background-color: #f2a5f4; color: #060606; font-size: 1.25em;&quot;&gt;this pink&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;This is about on the same level as HSL in terms of authoring and reading, but OKLCH fixes a &lt;a href=&quot;#problems-with-srgb&quot;&gt;number of problems with the sRGB colour space&lt;/a&gt; that makes it more consistent and reliable across its colour space. In addition, it offers both &lt;em&gt;more&lt;/em&gt; colours and colours that are &lt;em&gt;outside&lt;/em&gt; of the sRGB colour space, i.e. colours that were not achievable on the web before.&lt;/p&gt;
&lt;c-details&gt;
    &lt;summary&gt;Browser Support&lt;/summary&gt;
    &lt;div class=&quot;[ support ] [ box box--success ]&quot;&gt;&lt;div class=&quot;[ support__data ] [ flow ]&quot;&gt;&lt;p class=&quot;strong&quot;&gt;Desktop support:&lt;/p&gt;&lt;ul class=&quot;[ browser-support ]&quot;&gt;&lt;li class=&quot;[ supported ]&quot;&gt;Chrome: 111&lt;/li&gt;&lt;li class=&quot;[ supported ]&quot;&gt;Edge: 111&lt;/li&gt;&lt;li class=&quot;[ supported ]&quot;&gt;Firefox: 113&lt;/li&gt;&lt;li class=&quot;[ supported ]&quot;&gt;Opera: 97&lt;/li&gt;&lt;li class=&quot;[ supported ]&quot;&gt;Safari: 15.4&lt;/li&gt;&lt;/ul&gt;&lt;p class=&quot;strong&quot;&gt;Mobile support:&lt;/p&gt;&lt;ul class=&quot;[ browser-support ]&quot;&gt;&lt;li class=&quot;[ supported ]&quot;&gt;Android Browser: 111&lt;/li&gt;&lt;li class=&quot;[ supported ]&quot;&gt;Chrome (Android): 111&lt;/li&gt;&lt;li class=&quot;[ supported ]&quot;&gt;Firefox (Android): 113&lt;/li&gt;&lt;li class=&quot;[ supported ]&quot;&gt;Safari (iOS): 15.4&lt;/li&gt;&lt;li class=&quot;[ supported ]&quot;&gt;Samsung Internet: 22.0&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div class=&quot;[ support__meta ]&quot;&gt;&lt;p class=&quot;[ monospace strong ]&quot; style=&quot;font-size: var(--font-size-gamma-min);&quot;&gt;oklch&lt;/p&gt;&lt;p class=&quot;small&quot;&gt;Browser support data for &lt;code&gt;oklch&lt;/code&gt; comes from &lt;a href=&quot;https://github.com/mdn/browser-compat-data&quot;&gt;MDN’s &lt;code&gt;browser-compat-data&lt;/code&gt;&lt;/a&gt; and is up-to-date as of &lt;a href=&quot;https://www.npmjs.com/package/@mdn/browser-compat-data&quot; rel=&quot;external nofollow&quot;&gt;version 5.5.10&lt;/a&gt;.&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;
&lt;/c-details&gt;
&lt;h3&gt;Lightness&lt;/h3&gt;
&lt;div class=&quot;oklch-lightness-gradient&quot;&gt;&lt;/div&gt;
&lt;p&gt;Lightness here functions similarly to the HSL Lightness value in that it mixes your colour with different levels of black and white.&lt;/p&gt;
&lt;p&gt;You can see this effect no matter what the Chroma and Hue values are.&lt;/p&gt;
&lt;h3&gt;Chroma&lt;/h3&gt;
&lt;div class=&quot;oklch-chroma-gradient&quot;&gt;&lt;/div&gt;
&lt;p&gt;Chroma is similar, again, to HSL’s Saturation; it dictates &lt;q&gt;how much&lt;/q&gt; of our given Hue we want. What differs from HSL’s Saturation is that even when the Lightness is zero, we still get some colour, depending on how much Chroma we apply. So in this colour space, greyscale colours, including black and white, require that the Chroma value be 0.&lt;/p&gt;
&lt;p&gt;You’ll also notice that, like with HSL’s Saturation, when the Chroma is at 0%, it doesn’t matter what the Hue is anymore—given the same Lightness values and zero Chroma, changing Hue no longer affects the produced colour.&lt;/p&gt;
&lt;h3&gt;Hue&lt;/h3&gt;
&lt;div class=&quot;oklch-hue-gradient&quot;&gt;&lt;/div&gt;
&lt;p&gt;OKLCH’s Hue functions very much the same as HSL’s Hue, but the values don’t line up exactly the same. This is because unlike Hex/RGB and HSL, OKLCH operates in a different colour space and actually makes available (to supporting browsers and devices) even more colours than were available in the sRGB colour space.&lt;/p&gt;
&lt;p&gt;Try setting the Lightness to 50% and the Chroma to 100%, and then cycling through the values for Hue from 0° to 360°. This will give you an idea of what colours look like in their most saturated and untinted/unshaded form.&lt;/p&gt;
&lt;h2&gt;Colours in practice&lt;/h2&gt;
&lt;p&gt;This all came about when I decided that I wanted to add a &lt;em&gt;Sepia&lt;/em&gt; theme to my website (check out the &lt;a href=&quot;#theme-selector&quot;&gt;theme selector in the footer!&lt;/a&gt;), but I didn&#39;t have a clean and concise way to go about it. What I wanted was a way to slightly-tint all the colours on my website into the sepia range.&lt;/p&gt;
&lt;p&gt;Until recently, I had defined my colours manually, like this:&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token property&quot;&gt;--color-raven&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;oklch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;61.29% -0.034 -0.054&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token property&quot;&gt;--color-thunder&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;oklch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;12.2% 0 0&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token property&quot;&gt;--color-snowy&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;oklch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;98.2% 0 0&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token property&quot;&gt;--color-mineshaft&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;oklch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;28.9% 0 0&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token property&quot;&gt;--color-yeti&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;oklch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;89.8% 0 0&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token property&quot;&gt;--color-lynx&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;oklch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;17.6% -0.01 -0.014&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token property&quot;&gt;--color-bear&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;oklch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;96% -0.006 -0.01&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
...&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So building a theme where all of the colours are tinted sepia meant redefining each of the CSS Variables I had already defined for the default (non-sepia) theme.&lt;/p&gt;
&lt;p&gt;That’s where the incredible new CSS function, &lt;code&gt;color-mix()&lt;/code&gt;, comes in! Using it, I’ve been able to boil down my 13-colour palette into 3 core colours and 10 variations of those colours.&lt;/p&gt;
&lt;figure&gt;
	&lt;picture&gt;&lt;source type=&quot;image/avif&quot; srcset=&quot;/images/built/colour-lines.avif 346w&quot; sizes=&quot;100vw&quot;&gt;&lt;source type=&quot;image/webp&quot; srcset=&quot;/images/built/colour-lines.webp 346w&quot; sizes=&quot;100vw&quot;&gt;&lt;img alt=&quot;A pixel-art image showing how the three base colours mix to create ten variation colours in the thirteen-colour palette&quot; title=&quot;A pixel-art image showing how the three base colours mix to create ten variation colours in the thirteen-colour palette&quot; class=&quot;pixelated&quot; style=&quot;&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; src=&quot;/images/built/colour-lines.png&quot; width=&quot;346&quot; height=&quot;332&quot;&gt;&lt;/picture&gt;
&lt;/figure&gt;
&lt;p&gt;The first step is to set up some initial CSS variables to use for building out the &lt;code&gt;--color-*&lt;/code&gt; variables. These are the variables that we’ll later use to change themes, including our desired &lt;strong&gt;Sepia&lt;/strong&gt; theme.&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token property&quot;&gt;--snowy-lightness&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 98.2%&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token property&quot;&gt;--thunder-lightness&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 15%&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token property&quot;&gt;--monochrome-chroma&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token property&quot;&gt;--monochrome-hue&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;p&gt;&lt;span class=&quot;token property&quot;&gt;--raven-lightness&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 61.29%&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;
&lt;span class=&quot;token property&quot;&gt;--raven-chroma&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0.064&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;
&lt;span class=&quot;token property&quot;&gt;--raven-hue&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 237.73&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Next, we’ll build out the 3 base colours in the palette using the above variables, and from these 3 base colours, the 10 remaining colours in the palette can be constructed:&lt;/p&gt;
&lt;figure&gt;
    &lt;ul class=&quot; [ palette ] &quot;&gt;
        &lt;li style=&quot;background-color: oklch(61.29% 0.064 237.73); color: oklch(15% 0 0); flex: 1 0 100%;&quot;&gt;
            &lt;div class=&quot; [ delta ] &quot;&gt;Raven&lt;/div&gt;
            &lt;pre style=&quot;font-size: var(--font-size-small-min)&quot;&gt;oklch(&lt;br&gt;&amp;#9;var(--raven-lightness)&lt;br&gt;&amp;#9;var(--raven-chroma)&lt;br&gt;&amp;#9;var(--raven-hue)&lt;br&gt;)&lt;/pre&gt;
        &lt;/li&gt;
        &lt;li style=&quot;background-color: oklch(15% 0 0); color: oklch(98.2% 0 0); flex: 1 0 100%;&quot;&gt;
            &lt;div class=&quot; [ delta ] &quot;&gt;Thunder&lt;/div&gt;
            &lt;pre style=&quot;font-size: var(--font-size-small-min)&quot;&gt;oklch(&lt;br&gt;&amp;#9;var(--thunder-lightness)&lt;br&gt;&amp;#9;var(--monochrome-chroma)&lt;br&gt;&amp;#9;var(--monochrome-hue)&lt;br&gt;)&lt;/pre&gt;
        &lt;/li&gt;
        &lt;li style=&quot;background-color: oklch(98.2% 0 0); color: oklch(15% 0 0); flex: 1 0 100%;&quot;&gt;
            &lt;div class=&quot; [ delta ] &quot;&gt;Snowy&lt;/div&gt;
            &lt;pre style=&quot;font-size: var(--font-size-small-min)&quot;&gt;oklch(&lt;br&gt;&amp;#9;var(--snowy-lightness)&lt;br&gt;&amp;#9;var(--monochrome-chroma)&lt;br&gt;&amp;#9;var(--monochrome-hue)&lt;br&gt;)&lt;/pre&gt;
        &lt;/li&gt;
        &lt;li style=&quot;background-color: color-mix(in oklab, oklch(98.2% 0 0), oklch(15% 0 0) 83.6%); color: oklch(98.2% 0 0);&quot;&gt;
            &lt;div class=&quot; [ delta ] &quot;&gt;Mineshaft&lt;/div&gt;
            &lt;pre style=&quot;font-size: var(--font-size-small-min); text-align: start;&quot;&gt;color-mix(&lt;br&gt;&amp;#9;in oklab,&lt;br&gt;&amp;#9;var(--color-snowy),&lt;br&gt;&amp;#9;var(--color-thunder) 83.6%&lt;br&gt;)&lt;/pre&gt;
        &lt;/li&gt;
        &lt;li style=&quot;background-color: color-mix(in oklab, oklch(98.2% 0 0), oklch(15% 0 0) 66.6%); color: oklch(98.2% 0 0);&quot;&gt;
            &lt;div class=&quot; [ delta ] &quot;&gt;Kaiser&lt;/div&gt;
            &lt;pre style=&quot;font-size: var(--font-size-small-min); text-align: start;&quot;&gt;color-mix(&lt;br&gt;&amp;#9;in oklab,&lt;br&gt;&amp;#9;var(--color-snowy),&lt;br&gt;&amp;#9;var(--color-thunder) 66.6%&lt;br&gt;)&lt;/pre&gt;
        &lt;/li&gt;
        &lt;li style=&quot;background-color: color-mix(in oklab, oklch(98.2% 0 0), oklch(15% 0 0) 51.8%); color: oklch(98.2% 0 0);&quot;&gt;
            &lt;div class=&quot; [ delta ] &quot;&gt;Nickel&lt;/div&gt;
            &lt;pre style=&quot;font-size: var(--font-size-small-min); text-align: start;&quot;&gt;color-mix(&lt;br&gt;&amp;#9;in oklab,&lt;br&gt;&amp;#9;var(--color-snowy),&lt;br&gt;&amp;#9;var(--color-thunder) 51.8%&lt;br&gt;)&lt;/pre&gt;
        &lt;/li&gt;
        &lt;li style=&quot;background-color: color-mix(in oklab, oklch(98.2% 0 0), oklch(15% 0 0) 10.2%); color: oklch(15% 0 0);&quot;&gt;
            &lt;div class=&quot; [ delta ] &quot;&gt;Yeti&lt;/div&gt;
            &lt;pre style=&quot;font-size: var(--font-size-small-min); text-align: start;&quot;&gt;color-mix(&lt;br&gt;&amp;#9;in oklab,&lt;br&gt;&amp;#9;var(--color-snowy),&lt;br&gt;&amp;#9;var(--color-thunder) 10.2%&lt;br&gt;)&lt;/pre&gt;
        &lt;/li&gt;
        &lt;li style=&quot;background-color: color-mix(in oklab, oklch(61.29% 0.064 237.73), oklch(15% 0 0) 75%); color: oklch(98.2% 0 0);&quot;&gt;
            &lt;div class=&quot; [ delta ] &quot;&gt;Lynx&lt;/div&gt;
            &lt;pre style=&quot;font-size: var(--font-size-small-min); text-align: start;&quot;&gt;color-mix(&lt;br&gt;&amp;#9;in oklab,&lt;br&gt;&amp;#9;var(--color-raven),&lt;br&gt;&amp;#9;var(--color-thunder) 75%&lt;br&gt;)&lt;/pre&gt;
        &lt;/li&gt;
        &lt;li style=&quot;background-color: color-mix(in oklab, oklch(61.29% 0.064 237.73), oklch(15% 0 0) 54%); color: oklch(98.2% 0 0);&quot;&gt;
            &lt;div class=&quot; [ delta ] &quot;&gt;Wolf&lt;/div&gt;
            &lt;pre style=&quot;font-size: var(--font-size-small-min); text-align: start;&quot;&gt;color-mix(&lt;br&gt;&amp;#9;in oklab,&lt;br&gt;&amp;#9;var(--color-raven),&lt;br&gt;&amp;#9;var(--color-thunder) 54%&lt;br&gt;)&lt;/pre&gt;
        &lt;/li&gt;
        &lt;li style=&quot;background-color: color-mix(in oklab, oklch(61.29% 0.064 237.73), oklch(15% 0 0) 33%); color: oklch(98.2% 0 0);&quot;&gt;
            &lt;div class=&quot; [ delta ] &quot;&gt;Bowhead&lt;/div&gt;
            &lt;pre style=&quot;font-size: var(--font-size-small-min); text-align: start;&quot;&gt;color-mix(&lt;br&gt;&amp;#9;in oklab,&lt;br&gt;&amp;#9;var(--color-raven),&lt;br&gt;&amp;#9;var(--color-thunder) 33%&lt;br&gt;)&lt;/pre&gt;
        &lt;/li&gt;
        &lt;li style=&quot;background-color: color-mix(in oklab, oklch(61.29% 0.064 237.73), oklch(98.2% 0 0) 33%); color: oklch(15% 0 0);&quot;&gt;
            &lt;div class=&quot; [ delta ] &quot;&gt;Highland&lt;/div&gt;
            &lt;pre style=&quot;font-size: var(--font-size-small-min); text-align: start;&quot;&gt;color-mix(&lt;br&gt;&amp;#9;in oklab,&lt;br&gt;&amp;#9;var(--color-raven),&lt;br&gt;&amp;#9;var(--color-snowy) 33%&lt;br&gt;)&lt;/pre&gt;
        &lt;/li&gt;
        &lt;li style=&quot;background-color: color-mix(in oklab, oklch(61.29% 0.064 237.73), oklch(98.2% 0 0) 54%); color: oklch(15% 0 0);&quot;&gt;
            &lt;div class=&quot; [ delta ] &quot;&gt;Coyote&lt;/div&gt;
            &lt;pre style=&quot;font-size: var(--font-size-small-min); text-align: start;&quot;&gt;color-mix(&lt;br&gt;&amp;#9;in oklab,&lt;br&gt;&amp;#9;var(--color-raven),&lt;br&gt;&amp;#9;var(--color-snowy) 54%&lt;br&gt;)&lt;/pre&gt;
        &lt;/li&gt;
        &lt;li style=&quot;background-color: color-mix(in oklab, oklch(61.29% 0.064 237.73), oklch(98.2% 0 0) 75%); color: oklch(15% 0 0);&quot;&gt;
            &lt;div class=&quot; [ delta ] &quot;&gt;Bear&lt;/div&gt;
            &lt;pre style=&quot;font-size: var(--font-size-small-min); text-align: start;&quot;&gt;color-mix(&lt;br&gt;&amp;#9;in oklab,&lt;br&gt;&amp;#9;var(--color-raven),&lt;br&gt;&amp;#9;var(--color-snowy) 75%&lt;br&gt;)&lt;/pre&gt;
        &lt;/li&gt;
    &lt;/ul&gt;
&lt;/figure&gt;
&lt;div class=&quot; [ box ] &quot;&gt;&lt;p&gt;Why am I mixing colours with &lt;code&gt;in oklab&lt;/code&gt;?&lt;/p&gt;&lt;p&gt;I prefer the way that &lt;em&gt;OKLab&lt;/em&gt; mixes colours and traverses the colour space for gradients; although, I still much prefer the syntax of defining colours themselves using &lt;strong&gt;OKLCH&lt;/strong&gt;.&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;And with that, &lt;strong&gt;the 13-colour palette is complete&lt;/strong&gt;!&lt;/p&gt;
&lt;p&gt;Time to start putting all this work to use.&lt;/p&gt;
&lt;h3&gt;Applying a tint&lt;/h3&gt;
&lt;p&gt;Now that we have &lt;strong&gt;3 base colours&lt;/strong&gt; and &lt;strong&gt;10 variations&lt;/strong&gt;, built in the browser based on &lt;strong&gt;7 variables&lt;/strong&gt;, we can redefine just a few of those variables and affect the entire palette.&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;/* bring down the amount of white */&lt;/span&gt;
&lt;span class=&quot;token property&quot;&gt;--snowy-lightness&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 88%&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;p&gt;&lt;span class=&quot;token comment&quot;&gt;/* slight yellow tint to monochrome colours */&lt;/span&gt;&lt;br&gt;
&lt;span class=&quot;token property&quot;&gt;--monochrome-chroma&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0.06&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;
&lt;span class=&quot;token property&quot;&gt;--monochrome-hue&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 90&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;token comment&quot;&gt;/* slight yellow tint to raven-based colours */&lt;/span&gt;&lt;br&gt;
&lt;span class=&quot;token property&quot;&gt;--raven-chroma&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 0.034&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;
&lt;span class=&quot;token property&quot;&gt;--raven-hue&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 180&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;
&lt;h4&gt;Sepia Theme&lt;/h4&gt;
&lt;figure&gt;
    &lt;ul class=&quot; [ palette  thirds ] [ sepia ] &quot;&gt;
        &lt;li class=&quot; [ background--raven ] &quot; style=&quot;flex: 1 0 100%;&quot;&gt;
            &lt;div class=&quot; [ delta ] &quot;&gt;Raven&lt;/div&gt;
        &lt;/li&gt;
        &lt;li class=&quot; [ background--thunder ] &quot;&gt;
            &lt;div class=&quot; [ delta ] &quot;&gt;Thunder&lt;/div&gt;
        &lt;/li&gt;
        &lt;li class=&quot; [ background--snowy ] &quot;&gt;
            &lt;div class=&quot; [ delta ] &quot;&gt;Snowy&lt;/div&gt;
        &lt;/li&gt;
        &lt;li class=&quot; [ background--mineshaft ] &quot;&gt;
            &lt;div class=&quot; [ delta ] &quot;&gt;Mineshaft&lt;/div&gt;
        &lt;/li&gt;
        &lt;li class=&quot; [ background--kaiser ] &quot;&gt;
            &lt;div class=&quot; [ delta ] &quot;&gt;Kaiser&lt;/div&gt;
        &lt;/li&gt;
        &lt;li class=&quot; [ background--nickel ] &quot;&gt;
            &lt;div class=&quot; [ delta ] &quot;&gt;Nickel&lt;/div&gt;
        &lt;/li&gt;
        &lt;li class=&quot; [ background--yeti ] &quot;&gt;
            &lt;div class=&quot; [ delta ] &quot;&gt;Yeti&lt;/div&gt;
        &lt;/li&gt;
        &lt;li class=&quot; [ background--lynx ] &quot;&gt;
            &lt;div class=&quot; [ delta ] &quot;&gt;Lynx&lt;/div&gt;
        &lt;/li&gt;
        &lt;li class=&quot; [ background--wolf ] &quot;&gt;
            &lt;div class=&quot; [ delta ] &quot;&gt;Wolf&lt;/div&gt;
        &lt;/li&gt;
        &lt;li class=&quot; [ background--bowhead ] &quot;&gt;
            &lt;div class=&quot; [ delta ] &quot;&gt;Bowhead&lt;/div&gt;
        &lt;/li&gt;
        &lt;li class=&quot; [ background--highland ] &quot;&gt;
            &lt;div class=&quot; [ delta ] &quot;&gt;Highland&lt;/div&gt;
        &lt;/li&gt;
        &lt;li class=&quot; [ background--coyote ] &quot;&gt;
            &lt;div class=&quot; [ delta ] &quot;&gt;Coyote&lt;/div&gt;
        &lt;/li&gt;
        &lt;li class=&quot; [ background--bear ] &quot;&gt;
            &lt;div class=&quot; [ delta ] &quot;&gt;Bear&lt;/div&gt;
        &lt;/li&gt;
    &lt;/ul&gt;
&lt;/figure&gt;
&lt;p&gt;This makes it easy to change the &lt;q&gt;theme&lt;/q&gt; of my website just by manipulating the &lt;code&gt;raven&lt;/code&gt;-based variables. Critically, you might notice that the perceived brightness of the colours between these themes look much more consistant than what the &lt;strong&gt;RGB&lt;/strong&gt; colour space provided.&lt;/p&gt;
&lt;p&gt;&lt;noscript&gt;&lt;p class=&quot; [ box  box--error ] &quot;&gt;Unfortunately, this demo requires JavaScript to function correctly!&lt;/p&gt;&lt;/noscript&gt;&lt;/p&gt;
&lt;form id=&quot;demo-palette&quot; class=&quot; [ grid ] &quot; data-layout=&quot;50-50&quot; style=&quot;&quot;&gt;
	&lt;fieldset&gt;
		&lt;label for=&quot;input-snowy-lightness&quot; class=&quot; [ delta ] &quot;&gt;Snowy Lightness&lt;/label&gt;
		&lt;input id=&quot;input-snowy-lightness&quot; type=&quot;range&quot; min=&quot;0&quot; max=&quot;100&quot; value=&quot;98&quot; style=&quot;inline-size: 100%; line-height: 3;&quot; /&gt;
	&lt;/fieldset&gt;
	&lt;fieldset&gt;
		&lt;label for=&quot;input-thunder-lightness&quot; class=&quot; [ delta ] &quot;&gt;Thunder Lightness&lt;/label&gt;
		&lt;input id=&quot;input-thunder-lightness&quot; type=&quot;range&quot; min=&quot;0&quot; max=&quot;100&quot; value=&quot;15&quot; style=&quot;inline-size: 100%; line-height: 3;&quot; /&gt;
	&lt;/fieldset&gt;
	&lt;fieldset&gt;
		&lt;label for=&quot;input-monochrome-chroma&quot; class=&quot; [ delta ] &quot;&gt;Monochrome Chroma&lt;/label&gt;
		&lt;input id=&quot;input-monochrome-chroma&quot; type=&quot;range&quot; min=&quot;0&quot; max=&quot;0.4&quot; value=&quot;0&quot; step=&quot;0.01&quot; style=&quot;inline-size: 100%; line-height: 3;&quot; /&gt;
	&lt;/fieldset&gt;
	&lt;fieldset&gt;
		&lt;label for=&quot;input-monochrome-hue&quot; class=&quot; [ delta ] &quot;&gt;Monochrome Hue&lt;/label&gt;
		&lt;input id=&quot;input-monochrome-hue&quot; type=&quot;range&quot; min=&quot;0&quot; max=&quot;360&quot; value=&quot;0&quot; style=&quot;inline-size: 100%; line-height: 3;&quot; /&gt;
	&lt;/fieldset&gt;
	&lt;fieldset&gt;
		&lt;label for=&quot;input-raven-lightness&quot; class=&quot; [ delta ] &quot;&gt;Raven Lightness&lt;/label&gt;
		&lt;input id=&quot;input-raven-lightness&quot; type=&quot;range&quot; min=&quot;0&quot; max=&quot;100&quot; value=&quot;61&quot; style=&quot;inline-size: 100%; line-height: 3;&quot; /&gt;
	&lt;/fieldset&gt;
	&lt;fieldset&gt;
		&lt;label for=&quot;input-raven-chroma&quot; class=&quot; [ delta ] &quot;&gt;Raven Chroma&lt;/label&gt;
		&lt;input id=&quot;input-raven-chroma&quot; type=&quot;range&quot; min=&quot;0&quot; max=&quot;0.4&quot; value=&quot;0.06&quot; step=&quot;0.01&quot; style=&quot;inline-size: 100%; line-height: 3;&quot; /&gt;
	&lt;/fieldset&gt;
	&lt;fieldset style=&quot;grid-column: 1 / -1;&quot;&gt;
		&lt;label for=&quot;input-raven-hue&quot; class=&quot; [ delta ] &quot;&gt;Raven Hue&lt;/label&gt;
		&lt;input id=&quot;input-raven-hue&quot; type=&quot;range&quot; min=&quot;0&quot; max=&quot;360&quot; value=&quot;238&quot; style=&quot;inline-size: 100%; line-height: 3;&quot; /&gt;
	&lt;/fieldset&gt;
&lt;/form&gt;
&lt;figure&gt;
    &lt;ul id=&quot;output-palette&quot; class=&quot; [ palette  thirds ] [ output-palette ] &quot;&gt;
        &lt;li class=&quot; [ background--raven ] &quot; style=&quot;flex: 1 0 100%;&quot;&gt;
            &lt;div class=&quot; [ delta ] &quot;&gt;Raven&lt;/div&gt;
        &lt;/li&gt;
        &lt;li class=&quot; [ background--thunder ] &quot;&gt;
            &lt;div class=&quot; [ delta ] &quot;&gt;Thunder&lt;/div&gt;
        &lt;/li&gt;
        &lt;li class=&quot; [ background--snowy ] &quot;&gt;
            &lt;div class=&quot; [ delta ] &quot;&gt;Snowy&lt;/div&gt;
        &lt;/li&gt;
        &lt;li class=&quot; [ background--mineshaft ] &quot;&gt;
            &lt;div class=&quot; [ delta ] &quot;&gt;Mineshaft&lt;/div&gt;
        &lt;/li&gt;
        &lt;li class=&quot; [ background--kaiser ] &quot;&gt;
            &lt;div class=&quot; [ delta ] &quot;&gt;Kaiser&lt;/div&gt;
        &lt;/li&gt;
        &lt;li class=&quot; [ background--nickel ] &quot;&gt;
            &lt;div class=&quot; [ delta ] &quot;&gt;Nickel&lt;/div&gt;
        &lt;/li&gt;
        &lt;li class=&quot; [ background--yeti ] &quot;&gt;
            &lt;div class=&quot; [ delta ] &quot;&gt;Yeti&lt;/div&gt;
        &lt;/li&gt;
        &lt;li class=&quot; [ background--lynx ] &quot;&gt;
            &lt;div class=&quot; [ delta ] &quot;&gt;Lynx&lt;/div&gt;
        &lt;/li&gt;
        &lt;li class=&quot; [ background--wolf ] &quot;&gt;
            &lt;div class=&quot; [ delta ] &quot;&gt;Wolf&lt;/div&gt;
        &lt;/li&gt;
        &lt;li class=&quot; [ background--bowhead ] &quot;&gt;
            &lt;div class=&quot; [ delta ] &quot;&gt;Bowhead&lt;/div&gt;
        &lt;/li&gt;
        &lt;li class=&quot; [ background--highland ] &quot;&gt;
            &lt;div class=&quot; [ delta ] &quot;&gt;Highland&lt;/div&gt;
        &lt;/li&gt;
        &lt;li class=&quot; [ background--coyote ] &quot;&gt;
            &lt;div class=&quot; [ delta ] &quot;&gt;Coyote&lt;/div&gt;
        &lt;/li&gt;
        &lt;li class=&quot; [ background--bear ] &quot;&gt;
            &lt;div class=&quot; [ delta ] &quot;&gt;Bear&lt;/div&gt;
        &lt;/li&gt;
    &lt;/ul&gt;
&lt;/figure&gt;
&lt;h3&gt;Opacity vs. Transparency&lt;/h3&gt;
&lt;p&gt;I also have a set of defined opacities that I use with the &lt;code&gt;opacity&lt;/code&gt; property throughout my CSS:&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token property&quot;&gt;--mostly-opaque&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 90%&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token property&quot;&gt;--barely-opaque&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 10%&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;p&gt;&lt;span class=&quot;token property&quot;&gt;opacity&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;--barely-opaque&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The first instinct here might be to generate even more CSS variables for every combination of colour and opacity that I have defined, but we can actually use &lt;code&gt;color-mix()&lt;/code&gt; once again to reuse the CSS variables that we already have:&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token property&quot;&gt;--mostly-opaque&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 90%&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token property&quot;&gt;--barely-opaque&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 10%&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;p&gt;&lt;span class=&quot;token property&quot;&gt;background-color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;color-mix&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;in oklab&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;--color-thunder&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; transparent &lt;span class=&quot;token function&quot;&gt;calc&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;100% - &lt;span class=&quot;token function&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;--mostly-opaque&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;You’ll notice that I’m using &lt;code&gt;calc()&lt;/code&gt; at the end to invert the opacity variable. This is because opacity and transparency are opposites; if something is &lt;em&gt;opaque&lt;/em&gt;, it is &lt;em&gt;not transparent&lt;/em&gt;! (&lt;em&gt;Deep facepalm&lt;/em&gt; when I finally realised this.) So when we say we want something to be &lt;code&gt;90%&lt;/code&gt; opaque, it&#39;s the same as saying we want it to be &lt;code&gt;10%&lt;/code&gt; transparent, which the &lt;code&gt;calc()&lt;/code&gt; function achieves for us.&lt;/p&gt;
&lt;p&gt;&lt;noscript&gt;&lt;p class=&quot; [ box  box--error ] &quot;&gt;Unfortunately, this demo requires JavaScript to function correctly!&lt;/p&gt;&lt;/noscript&gt;&lt;/p&gt;
&lt;form id=&quot;demo-opacity&quot; class=&quot; [ grid ] &quot;&gt;
	&lt;fieldset style=&quot;grid-column: 1 / -1;&quot;&gt;
		&lt;label for=&quot;input-opacity&quot; class=&quot; [ delta ] &quot;&gt;Opacity&lt;/label&gt;
		&lt;input id=&quot;input-opacity&quot; type=&quot;range&quot; min=&quot;0&quot; max=&quot;100&quot; value=&quot;75&quot; style=&quot;inline-size: 100%; line-height: 3;&quot; /&gt;
	&lt;/fieldset&gt;
&lt;/form&gt;
&lt;div id=&quot;output-opacity&quot; class=&quot;output-color  output-opacity&quot;&gt;&lt;/div&gt;
&lt;h2&gt;Problems with new colour spaces&lt;/h2&gt;
&lt;p&gt;There are some limitations and gotchas to be aware of when using these new colour spaces; although, they have more to do with compatability and browser support than difficulty in describing and representing colour.&lt;/p&gt;
&lt;h3&gt;Fallbacks&lt;/h3&gt;
&lt;p&gt;First of all, older browsers that don’t support &lt;code&gt;oklch()&lt;/code&gt; (&lt;a href=&quot;/feature-watch/#oklch&quot;&gt;see modern browser support&lt;/a&gt;), for example, will require fallbacks wherever you use newer colour formats:&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;/* put one of these first: */&lt;/span&gt;
&lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; #5f8aa6&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;rgb&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;95&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 138&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 166&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;hsl&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;204 29% 51%&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token comment&quot;&gt;/* to fallback on from this, where the
entire line of CSS fails in
unsupported browsers: */&lt;/span&gt;
&lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;oklch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;61.29% 0.064 237.73&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;However, this does not work:&lt;/strong&gt;&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token property&quot;&gt;--color-raven&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; #5f8aa6&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token property&quot;&gt;--color-raven&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;oklch&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;61.29% 0.064 237.73&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Instead of what you’d hope would happen—older browsers ignore the second line—the &lt;code&gt;--color-raven&lt;/code&gt; variable is instead always set to the second value, even if it isn’t supported and won’t work. This is also important if you plan on supporting older browsers and using &lt;code&gt;color-mix()&lt;/code&gt; too (&lt;a href=&quot;/feature-watch/#css-color-function&quot;&gt;see modern browser support&lt;/a&gt;) because you’ll be unable to use the technique I’m using to combine colours.&lt;/p&gt;
&lt;p&gt;You can use the amazing website, &lt;a href=&quot;https://oklch.com/&quot;&gt;OKLCH Color Picker &amp;amp; Converter&lt;/a&gt; to calculate colours in the sRGB colour space that are relatively close to your OKLCH&lt;/p&gt;
&lt;h3&gt;Out of range&lt;/h3&gt;
&lt;p&gt;Secondly, there are areas of the new colour spaces you’ll find when using &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/oklch&quot;&gt;&lt;code&gt;oklch()&lt;/code&gt;&lt;/a&gt;, &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/oklab&quot;&gt;&lt;code&gt;oklab()&lt;/code&gt;&lt;/a&gt;, &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/lch&quot;&gt;&lt;code&gt;lch()&lt;/code&gt;&lt;/a&gt;, &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/lab&quot;&gt;&lt;code&gt;lab()&lt;/code&gt;&lt;/a&gt;, &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/color&quot;&gt;&lt;code&gt;color()&lt;/code&gt;&lt;/a&gt;, etc., that are &lt;em&gt;outside&lt;/em&gt; of the sRGB colour space, and therefore cannot be accurately represented in Hex, RGB, or HSL, for example.&lt;/p&gt;
&lt;p&gt;You may also run into the issue of &lt;em&gt;hardware&lt;/em&gt; being unable to present your vivid, new colours because they exist outside the colour space that a given display is built to show. I hope it’s only a matter of time before supporting hardware becomes more widespread and we can have more confidence that our colours will be presented to our website visitors just as we intend; although, I certainly dislike the waste involved in “upgrading” all those devices.&lt;/p&gt;
&lt;p&gt;However, like with new and emerging web standards, without adopting these new colour spaces, we’ll be missing out on huge chunks of a beautiful spectrum that the web of today is already ready for!&lt;/p&gt;
&lt;h2&gt;Taking this further&lt;/h2&gt;
&lt;p&gt;I can’t overstate how much clearer HSL and OKLCH colour formats are to read and author compared to Hex and RGB. Unless you’re using a CSS preprocessor like Sass/SCSS, it can be laborious to calculate combinations of colours or create tints, particularly if the colours in your palette ever change.&lt;/p&gt;
&lt;p&gt;Colour formats like HSL and OKLCH give us much more intuitive understanding of the nature of a given colour, and the ways to manipulate and create variations of those colours&lt;/p&gt;
&lt;p&gt;I hope you found this useful, and I’d love to know how others are doing this sort of things or what kind of pitfalls I might run into using this technique!&lt;/p&gt;
&lt;script&gt;
(async () =&gt; {
    &quot;use strict&quot;
&lt;p&gt;const inputRed = document.getElementById(&amp;quot;input-hex-red&amp;quot;)&lt;br&gt;
const inputGreen = document.getElementById(&amp;quot;input-hex-green&amp;quot;)&lt;br&gt;
const inputBlue = document.getElementById(&amp;quot;input-hex-blue&amp;quot;)&lt;br&gt;
const outputHex = document.getElementById(&amp;quot;output-hex&amp;quot;)&lt;/p&gt;
&lt;p&gt;const setHex = () =&amp;gt; {&lt;br&gt;
outputHex.setAttribute(&amp;quot;style&amp;quot;, &lt;code&gt;background-color: rgb(${inputRed.value}, ${inputGreen.value}, ${inputBlue.value});&lt;/code&gt;)&lt;br&gt;
}&lt;/p&gt;
&lt;p&gt;await [inputRed, inputGreen, inputBlue].forEach((input) =&amp;gt; {&lt;br&gt;
input.addEventListener(&amp;quot;change&amp;quot;, setHex)&lt;br&gt;
input.addEventListener(&amp;quot;input&amp;quot;, setHex)&lt;br&gt;
input.addEventListener(&amp;quot;touchstart&amp;quot;, setHex)&lt;br&gt;
input.addEventListener(&amp;quot;touchmove&amp;quot;, setHex)&lt;br&gt;
input.addEventListener(&amp;quot;touchend&amp;quot;, setHex)&lt;br&gt;
})&lt;/p&gt;
&lt;p&gt;const inputHue = document.getElementById(&amp;quot;input-hsl-hue&amp;quot;)&lt;br&gt;
const inputSaturation = document.getElementById(&amp;quot;input-hsl-saturation&amp;quot;)&lt;br&gt;
const inputLightness = document.getElementById(&amp;quot;input-hsl-lightness&amp;quot;)&lt;br&gt;
const outputHSL = document.getElementById(&amp;quot;output-hsl&amp;quot;)&lt;/p&gt;
&lt;p&gt;const setHSL = () =&amp;gt; {&lt;br&gt;
outputHSL.setAttribute(&amp;quot;style&amp;quot;, &lt;code&gt;background-color: hsl(${inputHue.value} ${inputSaturation.value}% ${inputLightness.value}%);&lt;/code&gt;)&lt;br&gt;
}&lt;/p&gt;
&lt;p&gt;await [inputHue, inputSaturation, inputLightness].forEach((input) =&amp;gt; {&lt;br&gt;
input.addEventListener(&amp;quot;change&amp;quot;, setHSL)&lt;br&gt;
input.addEventListener(&amp;quot;input&amp;quot;, setHSL)&lt;br&gt;
input.addEventListener(&amp;quot;touchstart&amp;quot;, setHSL)&lt;br&gt;
input.addEventListener(&amp;quot;touchmove&amp;quot;, setHSL)&lt;br&gt;
input.addEventListener(&amp;quot;touchend&amp;quot;, setHSL)&lt;br&gt;
})&lt;/p&gt;
&lt;p&gt;const inputL = document.getElementById(&amp;quot;input-oklch-lightness&amp;quot;)&lt;br&gt;
const inputC = document.getElementById(&amp;quot;input-oklch-chroma&amp;quot;)&lt;br&gt;
const inputH = document.getElementById(&amp;quot;input-oklch-hue&amp;quot;)&lt;br&gt;
const outputOKLCH = document.getElementById(&amp;quot;output-oklch&amp;quot;)&lt;/p&gt;
&lt;p&gt;const setOKLCH = () =&amp;gt; {&lt;br&gt;
outputOKLCH.setAttribute(&amp;quot;style&amp;quot;, &lt;code&gt;background-color: oklch(${inputL.value}% ${inputC.value} ${inputH.value});&lt;/code&gt;)&lt;br&gt;
}&lt;/p&gt;
&lt;p&gt;await [inputL, inputC, inputH].forEach((input) =&amp;gt; {&lt;br&gt;
input.addEventListener(&amp;quot;change&amp;quot;, setOKLCH)&lt;br&gt;
input.addEventListener(&amp;quot;input&amp;quot;, setOKLCH)&lt;br&gt;
input.addEventListener(&amp;quot;touchstart&amp;quot;, setOKLCH)&lt;br&gt;
input.addEventListener(&amp;quot;touchmove&amp;quot;, setOKLCH)&lt;br&gt;
input.addEventListener(&amp;quot;touchend&amp;quot;, setOKLCH)&lt;br&gt;
})&lt;/p&gt;
&lt;p&gt;const inputOpacity = document.getElementById(&amp;quot;input-opacity&amp;quot;)&lt;br&gt;
const outputOpacity = document.getElementById(&amp;quot;output-opacity&amp;quot;)&lt;/p&gt;
&lt;p&gt;const setOpacity = () =&amp;gt; {&lt;br&gt;
outputOpacity.setAttribute(&amp;quot;style&amp;quot;, &lt;code&gt;--output-opacity: ${inputOpacity.value}%;&lt;/code&gt;)&lt;br&gt;
}&lt;/p&gt;
&lt;p&gt;await [inputOpacity].forEach((input) =&amp;gt; {&lt;br&gt;
input.addEventListener(&amp;quot;change&amp;quot;, setOpacity)&lt;br&gt;
input.addEventListener(&amp;quot;input&amp;quot;, setOpacity)&lt;br&gt;
input.addEventListener(&amp;quot;touchstart&amp;quot;, setOpacity)&lt;br&gt;
input.addEventListener(&amp;quot;touchmove&amp;quot;, setOpacity)&lt;br&gt;
input.addEventListener(&amp;quot;touchend&amp;quot;, setOpacity)&lt;br&gt;
})&lt;/p&gt;
&lt;p&gt;const inputSnowyLightness = document.getElementById(&amp;quot;input-snowy-lightness&amp;quot;)&lt;br&gt;
const inputThunderLightness = document.getElementById(&amp;quot;input-thunder-lightness&amp;quot;)&lt;br&gt;
const inputMonochromeChroma = document.getElementById(&amp;quot;input-monochrome-chroma&amp;quot;)&lt;br&gt;
const inputMonochromeHue = document.getElementById(&amp;quot;input-monochrome-hue&amp;quot;)&lt;br&gt;
const inputRavenLightness = document.getElementById(&amp;quot;input-raven-lightness&amp;quot;)&lt;br&gt;
const inputRavenChroma = document.getElementById(&amp;quot;input-raven-chroma&amp;quot;)&lt;br&gt;
const inputRavenHue = document.getElementById(&amp;quot;input-raven-hue&amp;quot;)&lt;br&gt;
const outputPalette = document.getElementById(&amp;quot;output-palette&amp;quot;)&lt;/p&gt;
&lt;p&gt;const setPalette = () =&amp;gt; {&lt;br&gt;
outputPalette.setAttribute(&amp;quot;style&amp;quot;, &lt;code&gt;--snowy-lightness: ${inputSnowyLightness.value}%; --thunder-lightness: ${inputThunderLightness.value}%; --monochrome-chroma: ${inputMonochromeChroma.value}; --monochrome-hue: ${inputMonochromeHue.value}; --raven-lightness: ${inputRavenLightness.value}%; --raven-chroma: ${inputRavenChroma.value}; --raven-hue: ${inputRavenHue.value};&lt;/code&gt;)&lt;br&gt;
}&lt;/p&gt;
&lt;p&gt;await [inputSnowyLightness, inputThunderLightness, inputMonochromeChroma, inputMonochromeHue, inputRavenLightness, inputRavenChroma, inputRavenHue].forEach((input) =&amp;gt; {&lt;br&gt;
input.addEventListener(&amp;quot;change&amp;quot;, setPalette)&lt;br&gt;
input.addEventListener(&amp;quot;input&amp;quot;, setPalette)&lt;br&gt;
input.addEventListener(&amp;quot;touchstart&amp;quot;, setPalette)&lt;br&gt;
input.addEventListener(&amp;quot;touchmove&amp;quot;, setPalette)&lt;br&gt;
input.addEventListener(&amp;quot;touchend&amp;quot;, setPalette)&lt;br&gt;
})&lt;br&gt;
})()&lt;br&gt;
&lt;/script&gt;&lt;/p&gt;

		</content>
		</entry>
	<entry>
		<id>https://chrisburnell.com/article/halfway-cnd-2024/</id>
		<link href="https://chrisburnell.com/article/halfway-cnd-2024/" />
		<title>Halfway to CSS Naked Day 2024</title>
		<published>2023-10-09T12:00:00+00:00</published>
		<updated>2023-10-09T12:00:00+00:00</updated>
		<category term="article" scheme="https://chrisburnell.com/article/" label="Article" />
		<summary>What better time is there to prepare for next year’s CSS Naked Day than the halfway point? Certainly better than the day before, take it from me!</summary>
		<content type="html">
			&lt;p&gt;I was really happy to &lt;a href=&quot;/article/why-css-naked-day/&quot;&gt;participate in CSS Naked Day&lt;/a&gt; earlier this year, and today marks the halfway point to CSS Naked Day 2024. Just six more months until it’s time to don the &lt;a href=&quot;https://en.wikipedia.org/wiki/The_Emperor%27s_New_Clothes&quot;&gt;&lt;em&gt;Emperor’s New Clothes&lt;/em&gt;&lt;/a&gt; and &lt;q&gt;show off your &lt;code&gt;&amp;lt;body&amp;gt;&lt;/code&gt; for what it really is.&lt;/q&gt; &lt;small&gt;(&lt;a href=&quot;https://css-naked-day.github.io/&quot;&gt;CSS Naked Day&lt;/a&gt;)&lt;/small&gt;&lt;/p&gt;
&lt;p&gt;If you use &lt;a href=&quot;https://www.11ty.dev/&quot;&gt;Eleventy&lt;/a&gt; or use JavaScript to build your website, check out my &lt;em&gt;article&lt;/em&gt;, &lt;a href=&quot;/article/css-naked-day-javascript-function/&quot;&gt;CSS Naked Day JavaScript Function&lt;/a&gt;, for a swift guide to how I prepared for next year’s event, which actually &lt;a href=&quot;/article/why-css-naked-day/#how-long-is-a-day&quot;&gt;spans for &lt;em&gt;50 hours&lt;/em&gt;. 🤔&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;In the article, I explain how I’ve set up a Datetime check to figure out &lt;q&gt;Is it CSS Naked Day?&lt;/q&gt;. The result controls whether or not to link to CSS in my templates’ HTML, and the check runs every time my website builds.&lt;/p&gt;
&lt;p&gt;That includes CI/CD builds, which effectively means I can &lt;q&gt;set it and forget it&lt;/q&gt;, which I &lt;em&gt;love&lt;/em&gt; being able to do.&lt;/p&gt;
&lt;p&gt;Hope to see you participating on the 9&lt;sup&gt;th&lt;/sup&gt; of April as well!&lt;/p&gt;

		</content>
		</entry>
	<entry>
		<id>https://chrisburnell.com/note/moose-country/</id>
		<link href="https://chrisburnell.com/note/moose-country/" />
		<title>Moose Country</title>
		<published>2023-08-21T18:53:44+01:00</published>
		<updated>2023-08-21T18:53:44+01:00</updated>
		<category term="note" scheme="https://chrisburnell.com/note/" label="Note" />
		<summary>I took this photo at the Bog along the Cabot Trail in Cape Breton Highlands National Park.This is the 1000th post on my website!</summary>
		<content type="html">
			&lt;p&gt;I took this photo at the &lt;a href=&quot;https://parks.canada.ca/pn-np/ns/cbreton/activ/randonnee-hiking/tourbiere_bog&quot;&gt;&lt;q&gt;Bog&lt;/q&gt;&lt;/a&gt; along the &lt;em&gt;Cabot Trail&lt;/em&gt; in &lt;a href=&quot;https://parks.canada.ca/pn-np/ns/cbreton&quot;&gt;&lt;em&gt;Cape Breton Highlands National Park&lt;/em&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p class=&quot; [ box ] [ center ] [ gamma ] &quot;&gt;This is the &lt;a href=&quot;/stats/&quot;&gt;1000&lt;sup&gt;th&lt;/sup&gt; post&lt;/a&gt; on my website!&lt;/p&gt;

		</content>
		</entry>
	<entry>
		<id>https://chrisburnell.com/note/yahaha-in-halifax/</id>
		<link href="https://chrisburnell.com/note/yahaha-in-halifax/" />
		<title>Yahaha! in Halifax</title>
		<published>2023-08-18T10:47:00+01:00</published>
		<updated>2023-08-18T10:47:00+01:00</updated>
		<category term="note" scheme="https://chrisburnell.com/note/" label="Note" />
		<summary>Gotta stay alert outside the Art Gallery of Nova Scotia.</summary>
		<content type="html">
			&lt;p&gt;Gotta stay alert outside the Art Gallery of Nova Scotia.&lt;/p&gt;

		</content>
		</entry>
	<entry>
		<id>https://chrisburnell.com/note/canada-day-2023/</id>
		<link href="https://chrisburnell.com/note/canada-day-2023/" />
		<title>Note from July 1, 2023</title>
		<published>2023-07-01T12:24:18+01:00</published>
		<updated>2023-07-01T12:24:18+01:00</updated>
		<category term="note" scheme="https://chrisburnell.com/note/" label="Note" />
		<summary>Happy Canada Day! 🇨🇦 Have a good one, eh?</summary>
		<content type="html">
			&lt;p&gt;Happy Canada Day! 🇨🇦 Have a good one, eh?&lt;/p&gt;

		</content>
		</entry>
	<entry>
		<id>https://chrisburnell.com/article/double-double/</id>
		<link href="https://chrisburnell.com/article/double-double/" />
		<title>Double-Double</title>
		<published>2023-06-12T15:00:00+01:00</published>
		<updated>2023-06-12T15:00:00+01:00</updated>
		<category term="article" scheme="https://chrisburnell.com/article/" label="Article" />
		<summary>Today I’m introducing a little dash of CSS syntactic sugar I’ve been using a lot when building components recently that I’m calling the Double-Double technique.</summary>
		<content type="html">
			&lt;div class=&quot; [ box ] &quot;&gt;
&lt;p&gt;Skip to &lt;a href=&quot;#double-double-code&quot;&gt;the full &lt;strong&gt;Double-Double&lt;/strong&gt; technique&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;h2&gt;What is a Double-Double?&lt;/h2&gt;
&lt;p&gt;The &lt;strong&gt;Double-Double&lt;/strong&gt;, practically a proper noun in Canada, refers to a &lt;em&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Tim_Hortons&quot;&gt;Tim Horton’s&lt;/a&gt;&lt;/em&gt; coffee with two creams and two sugars. Although the quality of &lt;em&gt;Tim Horton’s&lt;/em&gt; has certainly declined, it was, once upon a time, a staple part of my diet, as it was/is for many Canadians, and I look back on them fondly.&lt;/p&gt;
&lt;h2&gt;What does this have to do with CSS?&lt;/h2&gt;
&lt;p&gt;The power of the &lt;strong&gt;Double-Double&lt;/strong&gt; technique is in using shorthand/logical properties and a clever feature of CSS Variables: the ability to provide a fallback value that gets used when a CSS Variable is not defined.&lt;/p&gt;
&lt;p&gt;We’ll use that feature &lt;em&gt;twice&lt;/em&gt;, nesting one CSS Variable inside another to provide a chain of values to be checked and used by the browser, and then &lt;em&gt;again&lt;/em&gt; as we use the technique alongside shorthand CSS properties.&lt;/p&gt;
&lt;p&gt;Let’s break that down.&lt;/p&gt;
&lt;h3&gt;Working with defaults&lt;/h3&gt;
&lt;p&gt;First, we’ll look at how default parameter values work in a JavaScript function. In this example, we’ve given the &lt;code&gt;wordsPerMinute&lt;/code&gt; parameter the default value of &lt;code&gt;200&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;language-javascript&quot;&gt;&lt;code class=&quot;language-javascript&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;token function-variable function&quot;&gt;readingtime&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token parameter&quot;&gt;numberOfWords&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; wordsPerMinute &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;200&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; Math&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;ceil&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;numberOfWords &lt;span class=&quot;token operator&quot;&gt;/&lt;/span&gt; wordsPerMinute&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This means that we can use the &lt;code&gt;readingtime&lt;/code&gt; function with &lt;em&gt;or&lt;/em&gt; without providing a &lt;code&gt;wordsPerMinute&lt;/code&gt; value—without one, the function will use our default value of &lt;code&gt;200&lt;/code&gt;.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;We can do something similar in our CSS. For example, we might want a component to have a default &lt;code&gt;font-size&lt;/code&gt;, but still give ourselves a uniform means of changing the &lt;code&gt;font-size&lt;/code&gt; for a variation of the component.&lt;/p&gt;
&lt;p&gt;Fortunately, CSS Variables give us this ability:&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.component&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;token property&quot;&gt;font-size&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;--font-size&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 1em&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;With this line of CSS, we’ve instructed our component to have a &lt;code&gt;font-size&lt;/code&gt; of &lt;code&gt;1em&lt;/code&gt;, and if the &lt;code&gt;--font-size&lt;/code&gt; CSS Variable has been defined it will be used instead. So if we wanted to create a variation of our component, all we need to do is &lt;em&gt;define&lt;/em&gt; &lt;code&gt;--font-size&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.component--variation&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;token property&quot;&gt;--font-size&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 5em&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This is super useful! We can use this technique for many properties and values that we might set on a given component, and because the syntax of defining defaults and overriding them (as above) is consistent, our CSS draws a clear distinction between &lt;q&gt;base-level&lt;/q&gt; component and &lt;q&gt;variations&lt;/q&gt; of those components.&lt;/p&gt;
&lt;h3&gt;Nested CSS Variables&lt;/h3&gt;
&lt;p&gt;One thing that’s great about using the &lt;code&gt;var()&lt;/code&gt; function in CSS is that it can be nested! We’ll use this to create a chain of checks before our component resolves to our defined value:&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.component&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;token property&quot;&gt;font-size&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;--first&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;--second&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 1em&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;With this line of CSS, we’ve given our component a set of ordered instructions for setting a &lt;code&gt;font-size&lt;/code&gt; value:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Use the &lt;code&gt;--first&lt;/code&gt; CSS Variable if it has been defined&lt;/li&gt;
&lt;li&gt;Use the &lt;code&gt;--second&lt;/code&gt; CSS Variable if it has been defined&lt;/li&gt;
&lt;li&gt;Otherwise, use the default &lt;code&gt;1em&lt;/code&gt; value&lt;/li&gt;
&lt;/ol&gt;
&lt;hr&gt;
&lt;p&gt;This is handy in all sorts of ways. Take the &lt;code&gt;fill&lt;/code&gt; colour of an SVG, for example:&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;svg&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;token property&quot;&gt;fill&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;--fill-interaction&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;--fill&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; currentColor&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;p&gt;&lt;span class=&quot;token selector&quot;&gt;:is(:hover, :focus, :active) &amp;gt; svg&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;
&lt;span class=&quot;token property&quot;&gt;--fill-interaction&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; red&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;token selector&quot;&gt;.dark-background svg&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;
&lt;span class=&quot;token property&quot;&gt;--fill&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; white&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;With some pretty terse and readable CSS, we’ve given the browser a whole suite of instructions to set the &lt;code&gt;fill&lt;/code&gt; colour of our SVGs:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Use a sensible default of &lt;code&gt;currentColor&lt;/code&gt; to match any text content that the SVG might be part of&lt;/li&gt;
&lt;li&gt;When the SVG is shown on top of a dark background, we want to force our SVGs to fill with the colour &lt;code&gt;white&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;When the SVG is inside an interactable element (e.g. inside a button), fill the SVG with &lt;code&gt;red&lt;/code&gt; on interaction with the element&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;What’s also really nice is that we can circumvent some nasty specificity issues by nesting CSS Variables. Because the nested values will be evaluated &lt;em&gt;in order&lt;/em&gt;, we, as the authors of the CSS, are in control, rather than the declaration with the highest specificity being in control.&lt;/p&gt;
&lt;p&gt;We get to choose which selectors or conditions (interaction states, media/container queries, etc.) trigger a CSS Variable to be defined, and in this context, we’re concerned solely with whether or not it’s defined as a boolean attribute, &lt;em&gt;not&lt;/em&gt; the specificity of the selector that defined it.&lt;/p&gt;
&lt;p&gt;This means that &lt;q&gt;switching on&lt;/q&gt; a CSS Variable can be done by a selector of any specificity, and, because CSS Variables will cascade, a selector which sets the values a CSS Variable can have less specificity than the selector which sets the property value itself:&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.flow &gt; * + *&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;token property&quot;&gt;margin-top&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;--spacing&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 1em&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
&lt;p&gt;&lt;span class=&quot;token selector&quot;&gt;h2&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;
&lt;span class=&quot;token property&quot;&gt;--spacing&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 5em&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I think, on the whole, this makes for a much more pleasant developer experience.&lt;/p&gt;
&lt;h2 id=&quot;double-double&quot; lang=&quot;fr&quot;&gt;Je voudrais un Double-Double, s&#39;il vous plaît&lt;/h2&gt;
&lt;p class=&quot;center  italic&quot;&gt;&lt;q&gt;I’d like a Double-Double, please&lt;/q&gt;&lt;/p&gt;
&lt;p&gt;It’s no secret that Logical Properties are one of my favourite additions to CSS in recent years. Consequentially, I’ve been thinking more and more about the &lt;em&gt;block&lt;/em&gt; and &lt;em&gt;inline&lt;/em&gt; axes of a webpage as I build components, and that’s where the &lt;strong&gt;Double-Double&lt;/strong&gt; technique comes in.&lt;/p&gt;
&lt;div class=&quot; [ box ] &quot;&gt;
&lt;p&gt;MDN has great content on &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_logical_properties_and_values&quot;&gt;logical properties and values&lt;/a&gt; and &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/CSS/Shorthand_properties&quot;&gt;shorthand properties&lt;/a&gt; if you want a refresher!&lt;/p&gt;
&lt;c-details&gt;
&lt;summary&gt;In short…&lt;/summary&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token property&quot;&gt;property&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; all&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token property&quot;&gt;property&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; block inline&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token property&quot;&gt;property&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; block-start inline block-end&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token property&quot;&gt;property&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; block-start inline-end block-end inline-start&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/c-details&gt;
&lt;/div&gt;
&lt;p&gt;Let’s switch from our &lt;code&gt;font-size&lt;/code&gt; example to one with &lt;code&gt;padding&lt;/code&gt; so we can work with shorthand and logical properties. In the next example, we’ll provide &lt;em&gt;two&lt;/em&gt; values to the &lt;code&gt;padding&lt;/code&gt; property, each value being a nested CSS Variable.&lt;/p&gt;
&lt;h3 id=&quot;double-double-code&quot;&gt;The Double-Double Technique&lt;/h3&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.component&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;token property&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
		&lt;span class=&quot;token function&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;--spacing-block&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;  &lt;span class=&quot;token function&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;--spacing&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 1em&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
		&lt;span class=&quot;token function&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;--spacing-inline&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;--spacing&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 1em&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This new &lt;q&gt;line&lt;/q&gt; of CSS (broken into three for readability) gives us a bunch of control over our component’s &lt;code&gt;padding&lt;/code&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Defining &lt;code&gt;--spacing&lt;/code&gt; sets a new &lt;code&gt;padding-block&lt;/code&gt; and &lt;em&gt;equal&lt;/em&gt; &lt;code&gt;padding-inline&lt;/code&gt; value&lt;/li&gt;
&lt;li&gt;Defining &lt;code&gt;--spacing-inline&lt;/code&gt; sets a new &lt;code&gt;padding-inline&lt;/code&gt; value, leaving &lt;code&gt;padding-block&lt;/code&gt; to the default value&lt;/li&gt;
&lt;li&gt;Defining &lt;code&gt;--spacing-block&lt;/code&gt; sets a new &lt;code&gt;padding-block&lt;/code&gt; value, leaving &lt;code&gt;padding-inline&lt;/code&gt; to the default value&lt;/li&gt;
&lt;li&gt;Defining any &lt;em&gt;two&lt;/em&gt; of &lt;code&gt;--spacing&lt;/code&gt;, &lt;code&gt;--spacing-block&lt;/code&gt;, and &lt;code&gt;--spacing-inline&lt;/code&gt; sets a new &lt;code&gt;padding-block&lt;/code&gt; value and a new &lt;code&gt;padding-inline&lt;/code&gt; value&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;And let’s not forget that CSS Variables will cascade and can be set to different values by multiple conditions. This means that once a variable has been set, or a component variation created, we’re still free to make variations by further overriding of the CSS Variables, based on different selectors or browser conditions!&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;When you extrapolate this idea across multiple properties for a component, you can start to see how much flexibility it affords you.&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.component&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;token property&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
		&lt;span class=&quot;token function&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;--spacing-block&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;  &lt;span class=&quot;token function&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;--spacing&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 1em&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
		&lt;span class=&quot;token function&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;--spacing-inline&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;--spacing&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 1em&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;token property&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
		&lt;span class=&quot;token function&quot;&gt;calc&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;2 * &lt;span class=&quot;token function&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;--spacing-block&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt;  &lt;span class=&quot;token function&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;--spacing&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 1em&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
		&lt;span class=&quot;token function&quot;&gt;calc&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;2 * &lt;span class=&quot;token function&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;--spacing-inline&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;--spacing&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 1em&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In this case, we’re defining both a &lt;code&gt;padding&lt;/code&gt; and &lt;code&gt;margin&lt;/code&gt; for our component with the &lt;strong&gt;Double-Double&lt;/strong&gt; technique. You’ll notice that their values are &lt;em&gt;almost&lt;/em&gt; identical, but we’ve instructed the component to have &lt;code&gt;margin&lt;/code&gt; values that are &lt;strong&gt;2×&lt;/strong&gt; the size of the &lt;code&gt;padding&lt;/code&gt;. We’ve baked this calculation right into the component’s declaration block, which means we don’t have to keep this mathematical relationship in our mind as we build out variations of this component and come up with new values to override the defaults.&lt;/p&gt;
&lt;p&gt;Like before, this allows us to make simple, one-line variations of our components in CSS that (can) have a tremendously-powerful and deep-reaching impact to the computed outcome in the browser:&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.component--variation&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;token property&quot;&gt;--spacing&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 5%&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;token property&quot;&gt;--spacing-block&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 120px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This one change results in a variation that has the computed values quite different from the default component’s:&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.component&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;token property&quot;&gt;padding-block-start&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 1em&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;token property&quot;&gt;padding-inline-end&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 1em&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;token property&quot;&gt;padding-block-end&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 1em&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;token property&quot;&gt;padding-inline-start&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 1em&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;p&gt;&lt;span class=&quot;token property&quot;&gt;margin-block-start&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 2em&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;
&lt;span class=&quot;token property&quot;&gt;margin-inline-end&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 2em&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;
&lt;span class=&quot;token property&quot;&gt;margin-block-end&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 2em&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;
&lt;span class=&quot;token property&quot;&gt;margin-inline-start&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 2em&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;token selector&quot;&gt;.component--variation&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;br&gt;
&lt;span class=&quot;token property&quot;&gt;padding-block-start&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 120px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;
&lt;span class=&quot;token property&quot;&gt;padding-inline-end&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 5%&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;
&lt;span class=&quot;token property&quot;&gt;padding-block-end&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 120px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;
&lt;span class=&quot;token property&quot;&gt;padding-inline-start&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 5%&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;token property&quot;&gt;margin-block-start&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 240px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;
&lt;span class=&quot;token property&quot;&gt;margin-inline-end&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 10%&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;
&lt;span class=&quot;token property&quot;&gt;margin-block-end&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 240px&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;
&lt;span class=&quot;token property&quot;&gt;margin-inline-start&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 10%&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;br&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Working &lt;em&gt;with&lt;/em&gt; the cascade gets us further, and with less effort, than trying to swim against the current.&lt;/p&gt;
&lt;h3&gt;Quadruple-Quadruple?&lt;/h3&gt;
&lt;p&gt;Now, this might seem like the next logical step to take with this technique, but, much like having &lt;em&gt;four creams&lt;/em&gt; and &lt;em&gt;four sugars&lt;/em&gt; in a coffee, it’s just a bit &lt;em&gt;too sweet&lt;/em&gt; for my tastes:&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;.component&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;token property&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt;
		&lt;span class=&quot;token function&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;--spacing-block-start&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;--spacing-block&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;--spacing&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 1em&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
		&lt;span class=&quot;token function&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;--spacing-inline-start&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;--spacing-inline&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;--spacing&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 1em&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
		&lt;span class=&quot;token function&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;--spacing-block-end&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;--spacing-block&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;--spacing&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 1em&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
		&lt;span class=&quot;token function&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;--spacing-inline-start&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;--spacing-inline&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;--spacing&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 1em&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;But maybe that’s just me—to each their own!&lt;/p&gt;
&lt;h2&gt;Over to you&lt;/h2&gt;
&lt;p&gt;Have you been using this technique yourself? Or any similar techniques? Found any neat ways to use it I haven’t covered here? I’d love to hear from you!&lt;/p&gt;

		</content>
		</entry>
	<entry>
		<id>https://chrisburnell.com/article/not-without-sacrifice/</id>
		<link href="https://chrisburnell.com/article/not-without-sacrifice/" />
		<title>Not without sacrifice</title>
		<published>2023-05-05T00:20:09+01:00</published>
		<updated>2023-05-13T09:13:00+01:00</updated>
		<category term="article" scheme="https://chrisburnell.com/article/" label="Article" />
		<summary>With the boom of JavaScript frameworks and legends-come-true like the new CSS parent selector, we’ve borne witness to an explosion of new technologies and ways to build for the web. But what tradeoffs have we made for all these new bells and whistles?</summary>
		<content type="html">
			&lt;p&gt;I recently had the pleasure of watching &lt;a href=&quot;https://www.jackfranklin.co.uk&quot;&gt;Jack Franklin’s&lt;/a&gt; talk from &lt;a href=&quot;https://heypresents.com/conferences/2023&quot;&gt;All Day Hey! 2023&lt;/a&gt;, &lt;a href=&quot;https://www.youtube.com/watch?v=Siq8eBkgpjY&quot;&gt;&lt;q&gt;Abstractions, complexities and off-ramps&lt;/q&gt;&lt;/a&gt;, and a couple of slides &lt;a href=&quot;https://youtu.be/Siq8eBkgpjY?t=2582&quot;&gt;at the end&lt;/a&gt; got me thinking about the landscape of developer concerns in front end; &lt;em&gt;a bit cynically, I’ll admit, but it comes back around in the end!&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;In recent years, there has been a growing emphasis on the importance of Developer Experience (&lt;em&gt;DX&lt;/em&gt;) in front end development. This has lead to the creation of powerful tools that assist developers in building and organising more feature-rich websites. With the introduction of new web technologies and seeing the maturity of beloved tools that have become essential to many in the field, suffice to say it has been an exciting time for web development.&lt;/p&gt;
&lt;figure&gt;
    &lt;div id=&quot;bars-2&quot; class=&quot;flow&quot; title=&quot;Now&quot;&gt;
        &lt;data class=&quot;dx  background--maple&quot; title=&quot;DX&quot; value=&quot;67%&quot;&gt;&lt;/data&gt;
        &lt;data class=&quot;ux  background--highland&quot; title=&quot;UX&quot; value=&quot;33%&quot;&gt;&lt;/data&gt;
    &lt;/div&gt;
&lt;/figure&gt;
&lt;p&gt;However, when we compare our efforts in &lt;em&gt;DX&lt;/em&gt; to efforts in User Experience (&lt;em&gt;UX&lt;/em&gt;), it is important to remember that &lt;strong&gt;resources are not infinite&lt;/strong&gt;. We can only expect to complete a day’s work in &lt;em&gt;nothing less&lt;/em&gt; than a day. A decade ago, when the capabilities of the web were fewer and we didn’t have such a wide array of tools to aid in our work, we had more time to focus on the user’s experience. Assuming, of course, you hadn’t spent the entire week debugging a &lt;q&gt;dropdown&lt;/q&gt; in Internet Explorer.&lt;/p&gt;
&lt;p&gt;As &lt;a href=&quot;/feature-watch/&quot;&gt;new web features&lt;/a&gt; bubble to the surface (growing now to a &lt;em&gt;rolling boil!&lt;/em&gt;) the responsibility for learning and implementing new and/or complex has shifted to the front end developer. As a result, the time we once dedicated to ensuring the best experience for all users has been consumed by more developer-centric tasks. Unfortunately, this has left experiences for users who are not browsing under optimal conditions neglected.&lt;/p&gt;
&lt;p&gt;In light of these constraints, our priorities as front end developers and the time we have to dedicate to each part of our work has shifted. Changing how we look at this shift puts the &lt;q&gt;battle&lt;/q&gt; between &lt;em&gt;DX&lt;/em&gt; and &lt;em&gt;UX&lt;/em&gt; in a different perspective:&lt;/p&gt;
&lt;figure&gt;
    &lt;div id=&quot;pie-2&quot; title=&quot;Now&quot;&gt;
        &lt;data class=&quot;dx  background--maple&quot; title=&quot;DX&quot; value=&quot;67%&quot;&gt;&lt;/data&gt;
        &lt;data class=&quot;ux  background--highland&quot; title=&quot;UX&quot; value=&quot;33%&quot;&gt;&lt;/data&gt;
    &lt;/div&gt;
&lt;/figure&gt;
&lt;p&gt;That being said, it seems like things are moving once again focus more on the &lt;em&gt;UX&lt;/em&gt; of our work—not to say that it’s &lt;em&gt;DX’s&lt;/em&gt; &lt;q&gt;turn&lt;/q&gt; to be thrown to the wayside, but that a concerted effort needs to be made to maintain an &lt;em&gt;appropriate balance&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;This shift hasn’t only just begun; we’ve seen great articles musing on this subject and even evidence of this shift in different forms today, e.g.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;a href=&quot;https://infrequently.org/2018/09/the-developer-experience-bait-and-switch/&quot;&gt;The &lt;q&gt;Developer Experience&lt;/q&gt; Bait-and-Switch&lt;/a&gt;&lt;/em&gt; by &lt;a href=&quot;https://infrequently.org/&quot;&gt;Alex Russell&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;a href=&quot;https://adactio.com/journal/15050&quot;&gt;Split&lt;/a&gt;&lt;/em&gt; by &lt;a href=&quot;https://adactio.com/&quot;&gt;Jeremy Keith&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;accessibility overlays (&lt;a href=&quot;https://adrianroselli.com/tag/overlay&quot;&gt;though mileage may vary&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;web features like &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion&quot;&gt;&lt;code&gt;prefers-reduced-motion&lt;/code&gt;&lt;/a&gt; and &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/CSS/color-scheme&quot;&gt;&lt;code&gt;color-scheme&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.gov.uk/guidance/accessibility-requirements-for-public-sector-websites-and-apps&quot;&gt;accessibility compliance laws&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;an ever-growing focus on &lt;a href=&quot;https://css-irl.info/building-a-greener-web/&quot;&gt;building greener websites&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It’s heartwarming to see concerns about performance, sub-optimal browsing conditions, diversity, and more being brought back to the forefront of our discussions about how we should build for the open and inclusive web that we want.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;A society grows great when there are those who would plant trees under whose shade they know they will never sit.&lt;/p&gt;
&lt;/blockquote&gt;

		</content>
		</entry>
	<entry>
		<id>https://chrisburnell.com/note/dynamic-heading-borders/</id>
		<link href="https://chrisburnell.com/note/dynamic-heading-borders/" />
		<title>Dynamic Heading Borders</title>
		<published>2023-04-17T23:47:02+01:00</published>
		<updated>2023-04-17T23:47:02+01:00</updated>
		<category term="note" scheme="https://chrisburnell.com/note/" label="Note" />
		<summary>I found a useful trick for achieving the long-standing design of Level 2 Headings across my website.</summary>
		<content type="html">
			&lt;p&gt;For a long time, I’ve had a specific look to the most-common heading in my articles: the Level 2 Heading, or &lt;code&gt;&amp;lt;h2&amp;gt;&lt;/code&gt; element. While doing some refactoring recently, in light of &lt;a href=&quot;/feature-watch/&quot;&gt;many developments on the frontiers of CSS&lt;/a&gt;, I found a new way to get the same result with a bit of new CSS that makes understanding &lt;em&gt;what it does&lt;/em&gt; a lot clearer, and clarity is always important—if not for your teammates or the wider web’s understanding, at least for future &lt;em&gt;you&lt;/em&gt;’s understanding!&lt;/p&gt;
&lt;h2&gt;Inception&lt;/h2&gt;
&lt;p&gt;In essence, what I want is for the borders underneath each heading to be the same width (&lt;code&gt;inline-size&lt;/code&gt;) as the text inside, plus a small but consistent amount. I decided to use the relatively-new CSS value, &lt;code&gt;fit-content&lt;/code&gt;, to achieve this:&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;h2&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;token property&quot;&gt;inline-size&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; fit-content&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;token property&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; flex&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;token property&quot;&gt;padding-inline-end&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;clamp&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;2.25rem&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 0.5rem + 4vw&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; 4.5rem&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
	&lt;span class=&quot;token property&quot;&gt;box-shadow&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; inset 0 -2px 0 #dddddd&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The new heavy-hitter here is the &lt;code&gt;fit-content&lt;/code&gt; value that I’m assigning to the &lt;code&gt;inline-size&lt;/code&gt; (&lt;code&gt;width&lt;/code&gt;). This means that the heading’s box will use the &lt;em&gt;available space&lt;/em&gt; as its content grows and will never exceed its computed &lt;code&gt;max-content&lt;/code&gt;, or however much space is taken up when its content does not wrap.&lt;/p&gt;
&lt;p&gt;Importantly, this allows me to limit the width of the headings without re-assigning the default &lt;code&gt;display: block;&lt;/code&gt; of headings, which browsers assign by default, to &lt;code&gt;display: inline-block;&lt;/code&gt;, for example. This would achieve the same visual effect for the headings &lt;em&gt;in a vacuum&lt;/em&gt;, but if placed around other elements which also have &lt;code&gt;display: inline-block;&lt;/code&gt; assigned to them, there’s the possibility that they’ll sit alongside the heading (in the inline axis) rather than headings appear on their own line.&lt;/p&gt;
&lt;p&gt;Forced line breaks around headings is already achieved by browser defaults, so I’m much happier relying on that and building progressively on top with fantastically-terse new CSS features like &lt;code&gt;fit-content&lt;/code&gt;.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;You can read more about &lt;code&gt;fit-content&lt;/code&gt; and its brethren, &lt;code&gt;max-content&lt;/code&gt; and &lt;code&gt;min-content&lt;/code&gt;, &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/CSS/fit-content&quot;&gt;on MDN&lt;/a&gt; as well as track its progress towards full stability across modern browsers on my &lt;a href=&quot;/feature-watch/#intrinsic-width&quot;&gt;Browser Feature Watch page&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&quot;[ support ] [ box box--warning ]&quot;&gt;&lt;div class=&quot;[ support__data ] [ flow ]&quot;&gt;&lt;p class=&quot;strong&quot;&gt;Desktop support:&lt;/p&gt;&lt;ul class=&quot;[ browser-support ]&quot;&gt;&lt;li class=&quot;[ supported ]&quot;&gt;Chrome: 22&lt;/li&gt;&lt;li class=&quot;[ supported ]&quot;&gt;Edge: 79&lt;/li&gt;&lt;li class=&quot;[ partial ]&quot;&gt;Firefox: 126&lt;/li&gt;&lt;li class=&quot;[ supported ]&quot;&gt;Opera: 15&lt;/li&gt;&lt;li class=&quot;[ supported ]&quot;&gt;Safari: 16&lt;/li&gt;&lt;/ul&gt;&lt;p class=&quot;strong&quot;&gt;Mobile support:&lt;/p&gt;&lt;ul class=&quot;[ browser-support ]&quot;&gt;&lt;li class=&quot;[ supported ]&quot;&gt;Android Browser: 4.4&lt;/li&gt;&lt;li class=&quot;[ supported ]&quot;&gt;Chrome (Android): 121&lt;/li&gt;&lt;li class=&quot;[ partial ]&quot;&gt;Firefox (Android): 122&lt;/li&gt;&lt;li class=&quot;[ supported ]&quot;&gt;Safari (iOS): 16&lt;/li&gt;&lt;li class=&quot;[ supported ]&quot;&gt;Samsung Internet: 4&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div class=&quot;[ support__meta ]&quot;&gt;&lt;p class=&quot;[ monospace strong ]&quot; style=&quot;font-size: var(--font-size-gamma-min);&quot;&gt;intrinsic-width&lt;/p&gt;&lt;p class=&quot;small&quot;&gt;Browser support data for &lt;code&gt;intrinsic-width&lt;/code&gt; comes from &lt;a href=&quot;https://caniuse.com/#feat=intrinsic-width&quot; rel=&quot;external nofollow&quot;&gt;caniuse.com&lt;/a&gt; and is up-to-date as of &lt;time datetime=&quot;2024-02-23&quot;&gt;23 February 2024&lt;/time&gt;.&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;

		</content>
		</entry>
	<entry>
		<id>https://chrisburnell.com/article/css-naked-day-javascript-function/</id>
		<link href="https://chrisburnell.com/article/css-naked-day-javascript-function/" />
		<title>CSS Naked Day JavaScript Function</title>
		<published>2023-04-17T07:49:36+01:00</published>
		<updated>2023-04-19T22:22:30+01:00</updated>
		<category term="article" scheme="https://chrisburnell.com/article/" label="Article" />
		<summary>Rather than remove CSS from my website manually on CSS Naked Day, I have employed a short JavaScript function to perform the check for me.</summary>
		<content type="html">
			&lt;p&gt;Recently, I wrote &lt;em&gt;&lt;a href=&quot;/article/why-css-naked-day/&quot;&gt;Why I participated in CSS Naked Day&lt;/a&gt;&lt;/em&gt;, discussing my experience preparing for CSS Naked Day and why it was so productive. Today I’ll explain how I turned off CSS across my website.&lt;/p&gt;
&lt;c-details&gt;
&lt;summary&gt;TL;DR: The JavaScript function&lt;/summary&gt;
&lt;pre class=&quot;language-javascript&quot;&gt;&lt;code class=&quot;language-javascript&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;token function-variable function&quot;&gt;cssnakedday&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; now &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; Date&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;now&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
	&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; thisYear &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;Date&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getFullYear&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
	&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; startEpoch &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;Date&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token template-string&quot;&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;thisYear&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;-04-09T00:00:00+1400&lt;/span&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getTime&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
	&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; endEpoch &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;Date&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token template-string&quot;&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;thisYear&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;-04-09T23:59:59-1200&lt;/span&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getTime&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;p&gt;&lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; startEpoch &lt;span class=&quot;token operator&quot;&gt;&amp;lt;=&lt;/span&gt; now &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; now &lt;span class=&quot;token operator&quot;&gt;&amp;lt;=&lt;/span&gt; endEpoch&lt;br&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;
&lt;/c-details&gt;&lt;/p&gt;
&lt;h2 id=&quot;in-eleventy&quot;&gt;Getting it into Eleventy&lt;/h2&gt;
&lt;p&gt;In Eleventy, there is a concept of &lt;a href=&quot;https://www.11ty.dev/docs/data-global/&quot;&gt;Global Data Files&lt;/a&gt;. These are files which live in a specific location in your project. Eleventy parses and exposes the data in these files to be consumed anywhere that we have access to Eleventy’s &lt;a href=&quot;https://www.11ty.dev/docs/data-cascade/&quot;&gt;Data Cascade&lt;/a&gt;, i.e. anywhere inside Eleventy templates/pages/etc.&lt;/p&gt;
&lt;p&gt;What is particularly useful is Eleventy’s ability to work with many types of data, allowing us, as authors, to build with what feels most comfortable. Typically, we might reach for JSON, XML, or even YAML to store some block of data, but Eleventy allows us to work with JavaScript data files as well. In the same way that Eleventy will parse data stored as JSON and expose it to us as an Object or Array, so too will Eleventy parse and expose data that is exported by a JavaScript file, whether it be an Object, Array, String, Boolean, Function, etc.&lt;/p&gt;
&lt;p&gt;This gives us the ability to expose data that is dynamic. In other words, we have the ability to modify what data comes out of a JavaScript file based on conditional checks, information that we pass &lt;em&gt;into&lt;/em&gt; the JavaScript file (in the case of an exported function, for example), information and data from other parts of Eleventy, and so on.&lt;/p&gt;
&lt;p&gt;In our case, the question that we&#39;re concerned with is: &lt;q&gt;Is it CSS Naked Day?&lt;/q&gt; When the answer is yes, &lt;strong&gt;do not&lt;/strong&gt; include references to CSS in our HTML. We’re able to answer that question by comparing datetimes:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;start of CSS Naked Day &lt;span style=&quot;font-weight: 900;&quot;&gt;&amp;lt;&lt;/span&gt; current datetime&lt;/li&gt;
&lt;li&gt;current datetime &lt;span style=&quot;font-weight: 900;&quot;&gt;&amp;lt;&lt;/span&gt; end of CSS Naked Day&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;When &lt;strong&gt;both&lt;/strong&gt; of those conditions hold true, we know that it is currently CSS Naked Day.&lt;/p&gt;
&lt;p&gt;Now let’s put our function into a Global Data File, e.g. &lt;code&gt;_data/cssnakedday.js&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&quot;language-javascript&quot;&gt;&lt;code class=&quot;language-javascript&quot;&gt;module&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function-variable function&quot;&gt;exports&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; now &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; Date&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;now&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
	&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; thisYear &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;Date&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getFullYear&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
	&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; startEpoch &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;Date&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token template-string&quot;&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;thisYear&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;-04-09T00:00:00+1400&lt;/span&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getTime&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
	&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; endEpoch &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;Date&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token template-string&quot;&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;thisYear&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;-04-09T23:59:59-1200&lt;/span&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;getTime&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;p&gt;&lt;span class=&quot;token keyword&quot;&gt;return&lt;/span&gt; startEpoch &lt;span class=&quot;token operator&quot;&gt;&amp;lt;=&lt;/span&gt; now &lt;span class=&quot;token operator&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; now &lt;span class=&quot;token operator&quot;&gt;&amp;lt;=&lt;/span&gt; endEpoch&lt;br&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The returned value of this function, a boolean &lt;code&gt;true&lt;/code&gt;/&lt;code&gt;false&lt;/code&gt;, can then be used throughout our templates, wherever we might include CSS in our HTML. Here’s an example using Nunjucks:&lt;/p&gt;
&lt;pre class=&quot;language-twig&quot;&gt;&lt;code class=&quot;language-twig&quot;&gt;&lt;span class=&quot;token twig language-twig&quot;&gt;&lt;span class=&quot;token delimiter punctuation&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;token tag-name keyword&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;not&lt;/span&gt; cssnakedday &lt;span class=&quot;token delimiter punctuation&quot;&gt;%}&lt;/span&gt;&lt;/span&gt;
	&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;link&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;rel&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;stylesheet&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;/css/global.css&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;/&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;token twig language-twig&quot;&gt;&lt;span class=&quot;token delimiter punctuation&quot;&gt;{%&lt;/span&gt; &lt;span class=&quot;token tag-name keyword&quot;&gt;endif&lt;/span&gt; &lt;span class=&quot;token delimiter punctuation&quot;&gt;%}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This way we don’t need to worry about manual intervention, and we can simply rebuild our website or let continuous deployment take care of the CSS Naked Day check and decide whether or not to include the &lt;samp&gt;link&lt;/samp&gt; tag in a template’s HTML.&lt;/p&gt;

		</content>
		</entry>
	
</feed>
