Color Easing Isn’t Always Easy

Comments Off on Color Easing Isn’t Always Easy

A fairly new addition to CSS is the ability to define midpoints between two color stops in a gradient.  You can do this for both linear and radial gradients, but I’m going to stick with linear gradients in this piece, since they’re easier to show and visualize, at least for me.

The way they work is that you can define a spot on the gradient where the color that’s a halfway blend between the two color stops is located.  Take the mix of #00F (blue) with #FFF (white), for example.  The color midway through that blend is #8080FF, a pale-ish blue.  By default, that will land halfway between the two color stops.  So given linear-gradient(90deg, blue 0px, white 200px), you get #8080FF at 100 pixels.  If you use a more generic 90deg, blue, white 100%, then you get #8080FF at the 50% mark.

linear-gradient(90deg, blue, white 100%)

If you set a midpoint, though, the placement of #8080FF is set, and the rest of the gradient is altered to create a smooth progression.  linear-gradient(blue 0px, 150px, white 200px) places the midway color #8080FF at 150 pixels.  From 0 to 150 pixels is a gradient from #F00 to #8080FF, and from 150 pixels to 200 pixels is a gradient from #8080FF to #FFF.  In the following case, #8080FF is placed at the 80% mark; if the gradient is 200 pixels wide, that’s at 160 pixels.  For a 40-em gradient, that midpoint color is placed at 32em.

linear-gradient(90deg, blue, 80%, white 100%)

You might think that’s essentially two linear gradients next to each other, and that’s an understandable assumption.  For one, that’s what used to be the case.  For another, without setting midpoints, you do get linear transitions.  Take a look at the following example.  If you hover over the second gradient, it’ll switch direction from 270deg to 90deg.  Visually, there’s no difference, other than the label change.

linear-gradient(<angle>, blue, white, blue)

That works out because the easing from color stop to color stop is, in this case, linear.  That’s the case here because the easing midpoints are halfway between the color stops—if you leave them out, then they default to 50%.  In other words, linear-gradient(0deg, blue, white, blue) and linear-gradient(0deg, blue, 50%, white, 50%, blue) have the same effect.  This is because the midpoint easing algorithm is based on logarithms, and is designed to yield linear easing for a 50% midpoint.

Still, in the general case, it’s a logarithm algorithm (which I love to say out loud).  If the midpoint is anywhere other than exactly halfway between color stops, there will be non-linear easing.  More to the point, there will be non-linear, asymmetrical easing.  Hover over the second gradient in the following example, where there are midpoints set at 10% and 90%, to switch it from  270deg to 90deg, and you’ll see that it’s only a match when the direction is the same.

linear-gradient(<angle>, blue, 10%, white, 90%, blue)

This logarithmic easing is used because that’s what Photoshop does.  (Not Mosaic, for once!)  Adobe proposed adding non-linear midpoint easing to gradients, and they had an equation on hand that gave linear results in the default case.  It was also what developers would likely need to match if they got handed a Photoshop file with eased gradients in it.  So the Working Group, rather sensibly, went with it.

The downside is that under this easing regime, it’s really hard to create symmetric non-linear line gradients.  It might even be mathematically impossible, though I’m no mathematician.  Regardless, its very nature means you can’t get perfect symmetry.  This stands in contrast to cubic Bézier easing, where it’s easy to make symmetric easings as long as you know which values to swap.  And there are already defined keywords that are symmetric to each other, like ease-in and ease-out.

If you’re up for the work it takes, it’s possible to get some close visual matches to cubic Bézier easing using the logarithmic easing we have now.  With a massive assist from Tab Atkins, who wrote the JavaScript I put to use, I created a couple of CodePens to demonstrate this.  In the first, you can see that linear-gradient(90deg, blue, 66.6%, white) is pretty close to linear-gradient(90deg, blue, ease-in, white).  There’s a divergence around the 20-30% area, but it’s fairly minor.  Setting an interim color stop would probably bring it more in line.  That’s partly how I got a close match to linear-gradient(90deg, blue, ease-out, white), which came out to be linear-gradient(90deg, blue, 23%, #AFAFFF 50%, 68%, white 93%).

Those examples are all one-way, however—not symmetrical.  So I set up a second CodePen where I explored recreations of a few symmetrical non-linear gradients.  The simplest example matches linear-gradient(90deg, blue, ease-in, white, ease-out, blue) with linear-gradient(90deg, blue, 33.3%, white 50%, 61.5%, #5050FF 75%, 84%, blue 93%), and they only get more complex from there.

I should note that I make no claim I’ve found the best possible matches in my experiments.  There are probably more accurate reproductions possible, and there are probably algorithms to work out what they would be.  Instead,  I did what most authors would do, were they motivated to do this at all: I set some stops and manually tweaked midpoints until I got a close match.  My basic goal was to minimize the number of stops and midpoints, because doing so meant less work for me.

So, okay, we can recreate cubic Bézier easing with logarithmic midpoints.  Still, wouldn’t it be cool to just allow color easing using cubic Béziers?  That’s what Issue #1332 in the CSS Working Group’s Editor Drafts repository requests.  From the initial request, the idea has been debated and refined so that most of the participants seem happy with a syntax like linear-gradient(red, ease-in-out, blue).

The thing is, it’s generally not enough to have an accepted syntax—the Working Group, and more specifically browser implementors, want to see use cases.  When resources are finite, requests get prioritized.  Solving actual problems that authors face always wins over doing an arguably cool thing nobody really needs.  Which is this?  I don’t know, and neither does the Working Group.

So: if you have use cases where cubic Bézier easing for gradient color stops would make your life easier, whether it’s for drop shadows or image overlays or something I could never think of because I haven’t faced it, please add them to the GitHub issue!

April 25th 2019 CSS

Responses to Negative Data: Four Senior Leadership Archetypes.

Comments Off on Responses to Negative Data: Four Senior Leadership Archetypes.

Not everything a company does works out.

(That is different from everything that a company is doing not working out. :))

If you are in the data business – my bread, butter and tofu – you often carry the burden of being the bearer of bad news.

The conversion rate is down 30% at launch.

The goal was to deliver a 30% increase in revenue, the team delivered 1.7953%.

During 2019, our Net Promoter Score has dropped 15 points.

The average length of our video ads is 30 seconds, less than 10% of the audiences watches beyond 5 seconds and 90% is exposed to less than 1 second.

Our Market Share in the 2-ton truck market shrunk by 1.5% (= -$3 bil).

Negative data.

Accurately collected. Intelligently analyzed. Factually presented.

Sadly still, negative data to the person/team receiving it.

Why be hurtin’?

A decade ago, data people delivered a lot less bad news because so little could be measured with any degree of confidence.

In 2019, we can measure the crap out of so much. Even with the limitations of tools, government regulations, and the astonishing fragmentation of everything (attention, devices, consumption sources, identities and more).

Companies have also evolved to be significantly more complex beings, who have to do so much more than what they did 50 years ago. Think of all P&G had to do to sell soap 50 years ago, and now reflect on the baffling array of things they have to do today to sell a bar of soap. Add on top of that, where P&G could sell soap, the purposes it could sell soap for, and imagine both of those things now. It is a lot of stuff!

When you do that much stuff, and you can measure almost everything… The result is that our ecosystem of data people are returning a lot more negative data when measuring performance of Marketing, Sales, User Experience and Customer Service.

Let me repeat this one more time: It is not that companies have slowly over the last decade started to suck more (well, maybe some). It is that we are able to analyze and identify bad performance with greater accuracy.

While that change has occurred, two things have obstinately stayed the same:

1. Company cultures are rarely open to hearing anything negative.

2. The top leaders in your company grew up, succeeded, and were promoted during the era of no data (and hence a ton less negative news). They are not natively wired to receive data-delivered reality checks.

The combination means no red carpet for negative data. It is not hard to see that a modern large corporation is likely missing out on the benefits of all they should know about their business through data. It also results in a depressing existence for data people.

Short-term, this let’s not listen to the negative data strategy sometimes actually works. No one is telling the Emperor he is naked, and the Emperor is delighted everyone loves his clothes so much.

Long-term…. : (

Four Negative Data Leadership Archetypes.

The solutions to this big opportunity have many dimensions.

I want to focus on the massive “make or break” dimension: #2 above, with Extremely Senior Leaders (ESLs).

Through their words and actions, ESLs can quash data's learn to improve spirit, or they can nurture that spirit and deliver a transformative, positive impact on the company's culture + profit.

In my work with clients around the world (all continents except Antarctica), I’ve encountered a whole host of reactions to when I have shared negative data with ESLs. From the patterns in those reactions, I’ve developed four archetypes of leaders.

While people are never starkly black and white, they typically have a dominant archetype – the one they most frequently demonstrate.

I’ve also observed cultural implications that each leader-type ends up creating from their reactions to negative data. For three of the four, I’ve seen individuals successfully navigate the leader-type – never without scars though – and individuals emotionally burn-out due the environment the leader creates.

Today, I want share the four leader archetypes with negative data as the lens. Included below is my accumulated wisdom, with the hope that you’ll fall in navigate category and not the crushed one.

Ready?

Archetype #1: The Bubble King (/Queen).

Archetype #1: How they react:

This individual lives in a bubble, so their reaction to any data is… Nothing. Data, unless it is super-positive, never makes it to them. Bubble Kings are comfortable making decisions that sound good – decisions just as likely to be informed by their long experience as the quest for shiny objects.

Bubble Kings most commonly reside in organizations where there is little to no accountability (or misplaced accountability, ex: celebration of vanity metrics).

Their most common reaction to negative data, if it makes it through, is to try to discredit it by asking analytically-nonsensical questions: What are the p-values of your multi-channel attribution model applied to performance of my strategy?

Archetype #1: Cultural implications:

In small or medium sized companies, Bubble Kings (/Queens) have short reigns. Not all that hard to imagine why – you don’t listen to data, ignore reality checks, and the transparently oriented accountability loop ensures there is nowhere to hide.

In large companies, or teams with massive budgets, Bubble Kings (/Queens) have long reigns. The accountability loops are larger, less transparent, and the natural large-company multi-layer organization complexity does not help. Typically a change in the C-Suite layer above will transition them out of the company (fresh eyes, sunshine … call it what you will).

However, while they still reign – since feelings matter more than data – sycophantic behavior is common and often encouraged.

Archetype #1: How to deal with them, their org:

Data will never play any impactful role on strategy. Since Bubble Kings live in a, well, bubble, you can often form relationships and influence at lower levels in a Bubble King’s org, and you can have a positive influence on tactics. Absolutely take advantage of it.

If you want to get promoted, give up the quest to identify factual real-world performance and focus instead on proving that the Bubble King's decisions deliver excellent results. Don't compromise on your ethics. But on this blog and in my newsletter I’ve shared enough strategies you should not use to slant data – use them.

[Bonus Reads: A Great Analyst's Best Friends: Skepticism & Wisdom! & TMAI #154: Irrationality, Cognitive Bias, and Us.]

Archetype #2: The Attacker.

Archetype #2: How they react:

They attack.

They attack the data. They attack your knowledge. They attack your intent. They bring up that one time in 2013 when your analysis missed an important assumption. They attack your personal attributes.

In the face of factual negative data related to their decisions, they will counter-attack. At times, harshly. Sometimes they counter-attack, in a twist of irony, by trying to drown you in enormous detail and minutiae.

You will be branded Ms. Bad News or Mr. Not A Team Player or some such ugly moniker.

Archetype #2: Cultural implications:

In extremely senior positions, Attackers fuel the creation of a culture where no bad news ever filters through. When business performance is non-positive, every employee, at every level, will work super-duper hard to look at every dimension of data to find any semblance of good news (no matter how small). Only this good news will make it to the top (Attacker ESL).

A typical example: The entire house is on fire but the analysis of that situation will focus on the one unsinged rose in the font lawn and how beautiful the rose is.

Attackers lead can last for a surprisingly long time in an organization, for a whole host of strategic reasons (as I’m confident you’ve observed as well).

Archetype #2: How to deal with them, their org:

If you are a data person and you are in a small organization lead by an Attacker, you need to update your resume and find a way out. There is no hope for your career (or emotional positivity).

If you are a data person and you are in a large organization lead by an Attacker, also update your resume. If, for any number of valid reasons, you are stuck there my advice is to focus your analytical efforts exclusively on the Attacker's biggest fears. It might take a little bit of effort to discover them, but it is so worth it. Even an Attacker has a point at which their instinct for self-preservation kicks in, in those rare (often hidden) situations they’ll be open to negative data.

And this is key: If you can provide solutions and not just data, you might even become a trusted adviser. This will do nothing to advance your acquired negative branding of Ms. Bad News, nor will this change the broader team/company culture… But…You'll have an impact with data, providing a pretty decent existence in an Attacker created culture while you look for a way out.

Archetype #3: The Rationalizer.

Archetype #3: How they react:

Their trigger instinct in face of factual negative data is to make excuses. To provide context. To identify circumstances to blame. To poke holes in the data/methodology (regardless of the Rationalizer’s analytical competence). To create enough uncertainty to fuzzy up any negative – or remotely negative – data.

If we were stack rank the four types, the Rationalizer would come on top as the most undesirable leader (often corrosive for the institution).

You might think it would be the Attacker. It is the Rationalizer because their approach to dealing with negative data is not as overtly corrosive. A Rationalizer subtly sows doubt. They dilute the analysis with non-facts. They force the inclusion of non-related nonsense in the quest to paint a fuller picture. At their worst, they commonly turn diamonds into coal.

Archetype #3: Cultural implications:

Everything data people do to highlight reality, to bring truth to the fore, to identify positive solutions from negative data, will be discounted, buried, and compete for impact with faith. Questionable analysis and slanted views will have equal footing with the most factual and intelligent analysis.

When people say "this team’s culture runs on BS," they are describing an organizations run by a Rationalizer.

Status quo will rule the day in such organizations, unless there is a big external force that creates change. The operative instinct is to maintain mediocrity with just enough reality massaging flowing upstream to ensure existing mediocrity is not utterly obvious.

One identifying attribute of Rationalizer organizations is the overwhelming abundance of data pukes. Why? Data pukes do nothing to make an organization intelligent, while providing the feeling of competence and productive output.

Archetype #3: How to deal with them, their org:

Rationalizer org’s are hardest to deal with because you are not obviously being ignored (Bubble King) nor are you being openly challenged (Attacker). You are just constantly being undercut to the point where the data represents a watered down version of an adjacent reality.

If you are a data person full of courage and determination, find the largest element of the business' strategy and unpack the power of strategic analysis to present factual data. Lead with as many things as you can find that are going right, then follow that with the most material two things that are factually not going right. Present the collection directly to the Rationalizer if you can.

On that note… Since the Rationalizer is an ESL (Extremely Senior Leader), it is quite possible that you have to work through many layers of people in-between you, my peer data person, and them. In a Rationalizer’s culture, every layer you go through will instinctively take the material two negative news and will try to kill it or fuzzify/massage it. In these cases, if you can make cosmetic changes to pass each layer, do so. Don't give up on the core of the positive and negative stories.

When you are in the presence of a Rationalizer, bring overwhelming analytical competence – there is no better way to deal with their reactions (see above). A Rationalizer never gives up trying to rationalize every small bit of negative data, persistence is a virtue that’ll come in handy.

Keep in close contact with your soul. At some point you’ll find it is sapping, it’ll be your clue that you need to find it a different professional environment.

Archetype #4: The Curious One.

Archetype #4: How they react:

In face of negative data, the Curious One asks you questions to understand the why behind what you are presenting.

If a period has elapsed where the data person has demonstrated competence, the Curious One does not question the analytical approach of data collection methodologies (they trust you to have applied fanatical quality control). The Curious One demonstrates, well, curiosity about what biases might be in the data or what assumptions you might have made.

They have two critical attributes: 1. They demonstrate open mindedness in the face of negative data. 2. Their posture is not to instinctively blame (backwards looking), but rather the posture is to identify and fix (forwards looking).

Archetype #4: Cultural implications:

Due to the demonstrated behavior at the top, open mindedness is usually encouraged in organizations led by Curious Ones.

Negative data is never a delightful experience, but the trust fostered amongst senior leaders results in a lot more truth telling, and is as good of a welcome mat as will ever be provided to the data people.

It might seem odd that in such a positive posture to negative data that there is still accountability, but incredibly in my experience it exists in spades in such organizations. It flows down from the clear measurable goals, an empowered data organization, and a close and direct partnership with different leadership levels (VPs, Directors, Sr. Managers).

Archetype #4: How to deal with them, their org:

Pinch yourself every day.

Don't take your position for granted. Invest in self-learning every week – even couple hours a week – to ensure you can keep pace with the demands for sophisticated analysis which will be expected at an agile pace.

You know my Care-Do-Impact model for analysis and storytelling. Organizations led by the Curious Ones are the very best places for you to slowly migrate your sophistication in Do and Impact. This, in turn, means that your demonstrated sophistication will open up new career options, for example becoming a business line leader or moving on to the strategy side of the house. Joyous outcomes for you, your company, and your company's customers.

Two Inspiring Examples | Curious One Archetype.

Paul Polman.

One person who demonstrated Curious One behavior to me was the recently ex-Global CEO of Unilever, Paul Polman. I had an opportunity to spend time with him and his leadership team. My role was to be a challenger, to share stories about what Unilever did well and focus on the challenges faced by vividly demonstrating things they did not do well. The latter part of the story qualifies as negative data.

It would be normal CEO behavior to be defensive, to pick the story apart, to make excuses. But, no. Through his words and actions to me and his brand CEOs, Mr. Polman demonstrated every attribute of the Curious One. This opened mind share required to re-imagine the future.

As with inspiring leaders, there is a whole ton lot more as to why I admire Mr. Polman.

Alan Mulally.

Mr. Mulally’s stewardship of Boeing and Ford is legendary. I want to share one story that Mr. Mulally shared with us in a meeting (and in his book).

When he got to Ford he instilled the same colored charts approach to identify what's working and what needs more attention. All the charts Mr. Mulally got were color coded green (#everythingisawesome). The problem was that Ford was on track to lose $17 billion dollars that year. Ford's culture was such that business leaders would hide problems, therefore making issues "disappear." Mr. Mulally set a different tone of honesty and looking at negative data as an opportunity to improve/change/fix (classic Curious One approach). In next meetings, things slowly started to turn Red… and Yellow… and some real Green.

There is a lot more to Mr. Mulally's turnaround of Ford. Eleven principles actually (buy the book!). But in this anecdote you can see the central reason that I adore him, and the leadership skills that can turn even the most intractable business problems in some of the largest companies on the planet.

A Plan for Action.

Humans are complicated beings.

No individual is just one black and white type.

Yet, humans, at least professionally, tend to demonstrate a dominant type. It is what they are natively comfortable with.

With that in mind, a suggestion for a plan of action…

Leader.

Introspective is in order. Assume you are doing this only for your own selfish benefit reasons, no one else has to know.*

Take a quiet moment.

Reflect on what your dominant type is: Bubble King or Attacker or Rationalizer or Curious one.

Once you do that, consider the impact that your leadership posture is having on your team, on your data people, on the ability of negative data (or negative anything) to help stop/rethink strategy, and indeed on the corporation.

The global maxima is that you consider a personal shift towards exploring the benefits of evolving to become the Curious One type (if you are not there already).

An incentive is that at some point in a long career, one does tend to reflect on the personal impact of one's professional accomplishments. In that moment, on that day/week/month/rest of your life, realizing the heart-breaking impact you delivered by being a Bubble King, Attacker or Rationalizer does deliver a heavy emotional burden and a personal crisis. So. Not. Worth it.

There is a meme that people can't really change who they are. You'd be surprised how untrue that is.

* Your team already knows what type you are. You might as well be honest with yourself for all the benefits that will come.

Individual.

Self-reflection is in order for you as well.

Set some quiet time aside so that you can consider the how they react and cultural implications demonstrated by the leader who has the biggest influence your personal work. (Sometimes this is your direct manager. Other times it is someone a few levels above yours.)

In your mind only, assign the archetype (BK, A, R, CO) to the leader. That act will bring clarity as you ask yourself these three questions I recommend…

What is your behavior in response to that dominant leader?

Is it as suggested in the how to deal with it section of each leader type?

What will it take for you to change your behavior to optimally deal with the situation you are in?

Make a specific plan.

Act on it. Life is short.

It is always better to be on a path chosen after careful self-reflection and planning, even if you find yourself in an undesirable situation. It might not deliver world peace, but it will reduce your emotional burden.

Bottom-line.

We've used leader reaction to negative data as a vehicle to discuss creating an optimal professional path for ourselves (as leaders or as individuals).

The framework I've shared, how they react, cultural implication, and how to deal with it, can be applied to multiple dimensions of our professional ecosystem. Give it a try.

If you are a leader, if you have a choice, be the Curious One. Here are a recap of the benefits: 1. Lighter personal emotional burden. 2. Cultures where the goal is not blame, it is making progress. 3. People who love you (yes, love, in a workplace!) and will help you deliver transformative results – in good times and bad.

So. Worth. It.

Good luck!

As always, it is your turn now.

What archetype identifies the most influential leader in your organization? If you are a leader, what archetype is reflective of your impact? If you’ve successfully worked inside organizations lead by a Bubble King (/Queen), Attacker, Rationalizer… What worked, what did not work? Have your seen a leader transform into a different archetype – do to an HR-induced or personal induced change? What worked, what did not work? Is there an archetype you would have created, if we are looking through the lens of negative data?

Please share your reflections, critique, culture-shifting strategies, and tips for individuals or leaders via comments.

Thank you.

The post Responses to Negative Data: Four Senior Leadership Archetypes. appeared first on Occam's Razor by Avinash Kaushik.

April 15th 2019 Uncategorized

Color Me FACE1E55

Comments Off on Color Me FACE1E55

There’s a long history in computer programming of using hexadecimal strings that look like English words to flag errors.  These are referred to, amusingly, as “magic debug values”, and yes, Wikipedia has the lowdown.  One of the most (in)famous is DEADBEEF, which was used “on IBM systems such as the RS/6000, also used in the classic Mac OS operating systems, OPENSTEP Enterprise, and the Commodore Amiga”, among others.  It’s also become the name of a Gnu/Linux music player, and apparently does not have anything to do with Cult of the Dead Cow, at least not so far as I could determine.  Maybe someone with more knowledge can drop a comment.

Anyway, one of the things about these magic debug values is they’re usually eight characters long.  Not always, as in the case of BADC0FFEE0DDF00D (from RS/6000, again), but usually.  Nintendo used 0D15EA5E in the GameCube and Wii to indicate a normal boot (!), iOS logs DEAD10CC when an application terminates in a specific yet incorrect manner, and FEEDFACE shows up in PowerPC Mach-O binaries , as well as the VLC Player application.  Just to pick a few examples.

The eight-character nature of these magic codes has meant that, for a long time, you couldn’t also use them on the sly to define colors in CSS, because it was limited to the #RRGGBB format.  Well, those days are over.  Long over.  Eight-digit hex color values are here, have been here a while, and are widely supported.  Here are a few swatches laid over a (fully opaque) white-to-black gradient.

#abadcafe
#baaaaaaa
#deadbeef
#deadfeed
#defec8ed
#feedbacc

If you’re using Internet Explorer or Edge, those aren’t going to work for you.  At least, not until Edge switches over to Blink; then, they should work just fine.

Thanks to the way they were constructed, by only using the letters A-F, most of the colors above are mostly opaque.  The last two digits in #RRGGBBAA set the alpha channel level of the color, just like the last part of the rgba() syntax.  Thus, the EF at the end of DEADBEEF sets the alpha value to 0.937; EF is equivalent to decimal 239, and 239 ÷ 255 = 0.937 (approximately).  In other words, #DEADBEEF is essentially equivalent to rgba(222,173,190,0.937).

That’s why, of the six swatches, only the sheepish #baaaaaaa and the homophonic #feedbacc let the background gradient show through more than very slightly; their alpha channels are 0.666 and 0.8, respectively.  The rest are 0.929 and up.

Being stuck in the A-F range is fairly constraining, but that’s where hexadecimal and English overlap, so that’s how it goes.  However, if you’re willing to turn to leetspeak syntax—that is, allowing yourself to use 0 as a substitute for O, 1 for L and occasionally I, 5 for S, 7 for T, and so on—then a lot more possibilities open up.  In addition to some of the classic error codes like fee1dead (Linux), I had fun devising other eight-character color words like acc0lade and face1e55, not to mention the very nautical ccccccc5.  (Think about it.)  Behold!

#0ff1c1a1
#1337c0de
#5e1f1e55
#a114c0de
#acc01ade
#ba5e1e55
#bada55e5
#bebada55
#beefc0de
#b0bafe77
#b0a710ad
#c010ca7e
#c0de1e55
#ccccccc5
#d0d0c0de
#dabbad00
#dead10ad
#deadd0d0
#decea5ed
#face1e55
#fee1dead

There are still more l33t-compliant number substitutions available, like 6 for G, but I felt like I was already pushing it with the examples I have.  One could also use calculator spelling, where 9 is a stand-in for g, and even mix together l33t and calculator syntaxes in the same value.  So many possibilities!

You may have noticed one value which creates no color: #DABBAD00, which has 00 for its alpha, so it’s fully, completely transparent.  It’s fully transparent #DABBAD, I suppose, but there’s really no difference between one transparent color and another, as far as I’m concerned.  I mean, if a color falls transparent, then there’s nobody to see it, so is it really a color at all?  I say thee nay.

If you’re familiar with the way #RRGGBB hex values can be represented with the shortened #RGB syntax, then it will probably come as little surprise that #RRGGBBAA has a shortened #RGBA syntax, where each digit is duplicated.  This opens the world of four-letter words to us!  Here are a few:

#10ad
#1337
#b007
#ba5e
#bead
#beef
#c0de
#cafe
#cede
#dada
#dead
#deed
#f00d
#fade
#f8ed
#feed
#0b0e

Here, we finally have a fully opaque word-color: #BEEF expands out to #BBEEEEFF, making the alpha value FF, which decimal-translates to 255, which is fully opaque.  So we get a nice opaque powdery blue out of BEEF, which is counterintuitive in the best possible way.  Also, every time I see BBEEEEFF, either in print or in my head, I hear Mrs. Which ordering dinner.

And okay, yes, #F8ED isn’t a four-letter word, it’s a four-symbol license-plate word.  So it’s even cooler.

If you’re thinking about using these in your CSS, you might be concerned about backwards compatibility, since any browser that doesn’t understand four- or eight-digit hexadecimal color values will just drop them on the floor.  That might be okay for text coloring, since the text will likely have some color, even if it’s browser-default, which is usually black.  For backgrounds, having colors ignored probably less okay, particularly if you set foreground colors that depend on the background colors.

There are a couple of possibilities here.  One is to use the cascade and CSS error handling to your advantage, in the time-honored pattern of doing the simpler version first and the more sophisticated version second.

#example {
   color: #DEA;
   color: #DEAD;
}

That works in simple scenarios, but for more complicated situations—say, ones where you have foreground and background depending on each other—feature queries are an option to consider, if for no other reason than cleaner organization and legibility.

#example {
   color: red;
   background: #EEE;
}

@supports (color: #ABCD) {
   #example {
      color: #f00d;
      background: #feed;
   }
}

Naturally and as usual, you’ll have to figure out what makes the most sense for your situation.  Maybe the right answer will be to avoid using these sorts of values at all, although I don’t know where the fun is in that.

At any rate, I hope you’ve enjoyed this little tour of magic debug values, l33tspeak, and color words.  As always, #feedbacc is more than welcome in the comments!

April 2nd 2019 CSS