6

Generate Accessible Button Colors With ButtonBuddy

 3 years ago
source link: https://dev.to/5t3ph/generate-accessible-button-colors-with-buttonbuddy-41mg
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Cover image for Generate Accessible Button Colors With ButtonBuddy

Generate Accessible Button Colors With ButtonBuddy

Jan 1

・2 min read

Introducing ButtonBuddy.dev:

Learn what it takes to ensure your buttons or button-styled links have accessible contrast across all states and surfaces, then use the generator to check and adjust your button palette.

Preview of Buddy the Button which is a blue button with a cartoon face. A speech bubble animates upwards then displays

First, Buddy will help you learn about what it takes to create accessible button color palettes.

Then, you can use the interactive generator to create or check your own button color palette to ensure accessible contrast.

The more successful contrast ratios you have, the happier Buddy will be!

Buddy's face first has a frown, then a partial closed mouth smile as the contrast improves, then finally a full open mouth smile plus a wink when the contrast is fully passing

When using the generator you have the option of either using the browser's native color pickers (the default) or switching to text input. Text inputs allow you to more easily enter your existing palette and will accept any valid CSS color value, including ones with an alpha channel.

Interacting first with the native color picker to select a purple, then toggling on the text inputs and changing the purple hex code to the CSS color value of

With every color change, by color picker or text input, the associated color contrast ratios will update. Emojis indicate "passing" or "invalid". The default text contrast is for normal text size which is 4.5:1, but if your button will use large text (18.66px and bold or larger than 24px) you can use the "Large text ratio" switch to update text ratios to the reduced ratio of 3:1.

Shows the contrast ratios dynamically updating and the emoji indicator changing when the ratio passes, followed by updating the text ratio to 3.0 by using the

Visit ButtonBuddy.dev to learn more about accessible button contrast and create your own accessible palettes!

Creator's Notes

ButtonBuddy was created by myself, Stephanie Eckles, to help folx solve a common issue I see as both a code reviewer and a web user. ButtonBuddy is also a utility I myself have wanted to see exist, and know I will use!

If you encounter any issues or have a feature request, file an issue on GitHub. Please be sure to read the intro learning content which describes the specific scenario ButtonBuddy was created for before suggesting a feature.


Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK