Check Contrast between Two Colors in Ubuntu Linux via Kontrast

For designers want to check color contrast, there are a few handy little tools in Linux Desktop to do the job. Kontrast is the one designed for KDE though works on all Linux desktops.

GNOME has a stylish color contrast tool. Though it’s now in early stage which does not work well and freezes often at least in my case. Here I’ll introduce the KDE’s Kontrast.

This little app displays font color for text and another color as background. Users may change the font and background colors by:

  • manually input a color value.
  • use built-in color picker.
  • drag slider bar to change hue, saturation, and lightness.
  • or use “Randomize” button to generate a pair of colors.

For each color combination, it displays the contrast ratio, and readability (“Perfect”, “Good”, or “Bad”) for normal and large text. There’s also “Invert” button to reverse the two colors. As you can see, it allows to mark color as favorite, though it somehow always fail in my case.

How to Install Kontrast in Ubuntu via apt:

For Ubuntu 21.04 and Ubuntu 21.10, this handy tool has been made into official Ubuntu repositories. Simply press Ctrl+Alt+T on keyboard to open terminal and run command to install it:

sudo apt install kontrast

Though for non-KDE desktop, there will be a lot of dependency libraries also to be installed.

Install Kontrast in Ubuntu 20.04 and older versions:

Ubuntu 20.04, Ubuntu 18.04, and even Ubuntu 16.04 users may install the latest version using the Linux universal flatpak package.

1.) Firstly, press Ctrl+Alt+T on keyboard to open terminal. Then run command to install the flatpak daemon:

sudo apt install flatpak

Ubuntu 18.04 and 16.04 need to add this stable PPA first.

2.) Next, add the flathub repository that hosts the package:

flatpak remote-add --if-not-exists flathub

3.) Finally install the color contrast checker app via command:

flatpak install flathub org.kde.kontrast

For first time installing KDE app as flatpak, there are almost 800 MB run-time libraries to be installed:

Once installed, search for and open the tool from activities overview screen and enjoy!

How to Remove Kontrast:

To remove the package installed via apt, use command:

sudo apt remove --autoremove kontrast

For the flatpak, use this command instead to remove it:

flatpak uninstall --delete-data kontrast

And run flatpak uninstall --unused command will delete the unused run-time libraries.