I’m currently working with trying to bring text accessibility into the visual design of a SaaS product suite, which has cross-product primary and system feedback colors and a number of product-specific accent/secondary colors. Because we’re SaaS, for our clients, we also permit them to select brand colors that are used for certain elements on client-configured pages shown to end-users.
One of those brandable elements are our action buttons and some page banners, so to make sure we maintain accessibility, we use white text and only allow clients to choose brandable colors that have high enough contrast to meet a 1:4.5 contrast ratio. So, white text is a constraint here.
We also use Angular Material as a base for our own components, and for text accessibility, they do what Google Material does, which is to simply automate the use of white or black text at a certain transparency depending on the hex you use for the container to always maintain a minimum contrast ratio of 1:4.5.
But if we were to do that, we’re using white text for some buttons on parts of the UI that are client branding agnostic [e.g. a client dashboard that shows multiple clients] and potentially using white or black text for other buttons that are branded elements for client specific parts of the UI [the client specific pages, where a client company can configure custom content for their end-users and where we’d show brand colors]. So white labels has to be a thing.
My Current Struggle
So with those constraints in mind, my current struggle is trying to find a new primary blue that works with white text. This is our client agnostic primary color, which is overriden with the use of a branded color.
Our current hex is 3E99D8 (HSL 204.5°, 66.4, 54.5), which is fine to use with large-scale text, since it’s contrast with white is 3.1, but we obviously don’t want to use action buttons with 24px/18pt nonbold or ~19px/14 pt bold text sizes, since our body copy is 16px/12pt regular font.
Similarly, for our market, we need this primary color to still be blue, given our verticals/subject matter/marketing/etc.
Note: I’m using HSL while exploring alternatives only because it’s easier to work with, even though RGBA would give me more colors to pick from.
Exploring Alternative Colors
So, thus far, I’ve tried increasing the saturation, since 3E99D8 isn’t 100% saturation, but that nothing to help increase the contrast with white text. If I increase the saturation, I have to lower the lightness, but if I lower the saturation, the color becomes more grey than blue, since changing the saturation only either adds or subtracts the amount of hue in the color, which effectively means I’m similarly adding or subtracting equal amounts of black and white in the color.
I can increase the contrast easily by making 3E99D8 darker, going from a .55 lightness value to a .43 lightness value, which gives me #257bb7. However, there has been some feedback that this is too dark and too different a blue.
So, lastly, I’ve attempted to use different hue values entirely, but because of that, it makes finding a solid threshold for the lightness and saturation values problematic because a different hue will have it’s own slightly different saturation and lightness minimum values to meet a minimum contrast of 4.5.
This also means changing any other colors in our color palette to become accessible also becomes problematic, since there’s no way to easily maintain a consistent perceived brightness across the palette, since different hues with the same perceived brightness may very well have very different saturation and lightness values.
From some experimentation using Colorable, I’m finding that hues closer to pure blue (H=240) can have a greater lightness value and lower saturation and still meet the minimum contrast, but blues that are closer to pure green (H=120), have to be darker and less saturated for adequate contrast.
I’m limited by lowering saturation either way, since below 50% saturation, the color becomes more grey than blue, but at 100% saturation, I have to keep a darker lightness value, since the color becomes so much brighter, and obviously I have to keep lightness below 60%, since anything lighter is too close to white to keep the minimum contrast. So, at this point, I’m kind of blocked when it comes to finding a new blue that’s near 3E99D8 but still accessible with white text.
So, now for my questions:
- Can anyone explain in layman’s terms why pure green and pure blue (120 and 240 hue values, 100% saturation, 50% lightness) have different contrast ratios with white, especially if white is supposed to be comprised of equal amounts of blue, green, and red?
- How can I proceed with systematically trying to find a blue close to 3E99D8 that meets contrast with white text, but isn’t drastically different?
- How could this exploration improve or worsen if I try to use another color model? Is a systematic exploration of this even possible with other color models?
- Is this overkill entirely and I should just push for #257bb7 to become our new primary blue?