Color Perception – How To Produce Dark Blue Without a Hint of Purple

Priya Kalyanakrishnan 04 Sep, 2021 • 6 min read

This article was published as a part of the Data Science Blogathon

Introduction

In this article, we discuss colour perception. The article can benefit individuals in graphical media art. The challenge of creating art with a deep dark blue can become challenging, as purple may appear instead. 

As we dive deeper into the world of Hex colour codes in Python, we look at two typical colours. These colors are blue and purple. The illusion is that they usually betray the naked eye when viewed through a lens of various devices’ hardware and software. As each device comprises unique hardware specifications, the effects of visual perception could become manipulated and skewed to an extent.

There are plenty of resources to refer to when backing up this observation. One includes an article from Lightning Source(https://help.lightningsource.com/hc/en-us/articles/211671103-Why-the-Color-Blue-Turns-Purple) and another is from Replica Printing(https://replicaprinting.com/2015/07/printing-blues/).

What readers could learn from this article on Color Perception

  • Hex codes.
  • How to combine different tools together.
  • How to incorporate results from a front-end tool with a back-end tool.
  • Python graphic library.

Purpose of Color Perception

With many websites displaying colors, each input value that represents a color could become misconstrued with manipulation and how colors appear within certain software and hardware. This article can become a supplemental resource for how codes can easily pinpoint how to create a seamless route to select the most appropriate Hex code.

Goal

The goal is to apply this observation of blending in additional cyan to the Hex code into Python. What this truly is conveying is that not all is what it seems for a dark shade of blue. Purple could be visible instead.

Requirements

This tutorial uses the following; however, if you have alternatives that may comprise the same results, you are free to use them.

  • Jupyter Notebook with Kali Linux at root
  • Python also at root
  • Cyber Link PhotoDirector 12

Agenda

  • About Hex Codes
  • Background Description of Requirements
  • Further Information
  • Python Codes
  • Cyber Link PhotoDirector 12
  • Python Codes [To Verify]
  • Conclusion
  • Takeaways
  • References

About Hex Codes

Before getting into the steps, here is a brief description of Hex codes. Hex codes identify and associate with each color available. It is possible to enter a color with its original name in plenty of programs; however, it is effective to use a code that can become understandable universally. In this article, a Hex code is valuable in associating a color throughout front-end and back-end processes.

Background Description of Requirements

Jupyter Notebook is a highly modular and effective tool in replacement of a regular Python Shell application. Graphics can become apparent when the tool is comingling with Kali Linux. We usually know Kali Linux for cyber security and other testing in computer security scenarios. In this article, it is used to display graphics. When path and other applications are not corresponding with each other without the Kex application within Kali Linux, a display error appears. Something similar to the following message,

“TclError: no display name and no $DISPLAY environment variable.”

TCLerror | Color Perception

Python is a versatile coding application used in several areas, and this article proves Python is consistently a helpful tool. Last, Cyber Link PhotoDirecter 12 is just a different version of Adobe PhotoShop. It is a front-end user-friendly application that does not have extensive use of codes.

Once a reasonable number of the requirements match, let’s get started.

Further Information

Here is a back story of how blue and purple seemed to become entangled within each other.

The frequent use of dark blue appeared to become necessary for pictures that needed a particular shade of blue. Instead of blue, a shade of purple often appeared on every device and software application. This was not the result desired. Cyan should become increased, as the referenced articles have mentioned.

By combining the required tools together, Cyber Link PhotoDirector 12 had helped distinguish what Hex code Python code read in and evaluate as well as replicate the Hex code color.

Instead of showing the disappointing side of producing purple instead of blue, the article shows how to produce a Hex code in a front-end application and verify the color with a back-end application.

As an amateur website designer, I can find it tedious to find the exact Hex code to produce a dark blue without a finished product of purple. However, the following can cut down on time spent on redoing color tones. By using Python Turtle or any graphic-friendly module, it can simulate and recreate the Hex code to the associate color. The purpose of using Python is to verify the color is consistently the same color.

Here we go.

Python Codes for understanding Color Perception

First, ensure that the Python can produce the proper output accordingly with the following code.

Remember, if Turtle is not available in your library, enter the following command in a Kali Linux Root window:

pip3 install turtle

Input

from turtle import *
screen = Screen()
screen.setup(400,400)
screen.bgcolor('white')

What does the above code do?

The code above does:

First, it imports the library and its modules. Second, it started with a screen. Third, a specification of the screen size. Last, along with the setup of the screen, is the background color.

Can we use different variations?

Yes, any combination is useable according to requirements and or preferences. For example, if a white background color is not preferable, then any other available color can replace white. Another example includes adjusting the window dimensions to another numerical height and width.

Output

Jupyter notebook | Color Perception

Cyber Link PhotoDirecter 12

Next, look at what we could learn with a front-end application to find a suitable Hex code.

From some calibrations and consideration of increasing the amount of cyan in an image, Cyber Link has provided some great Hex codes just with the mouse over tool using the color picker fill option.

Below is the Cyber Link Color Picker.

photo director | Color Perception

Now that Cyber Link provided the Hex code, Python can provide us with the assurance that this color is, in fact, dark blue. Another point to note, the color selected is located more towards Cyan instead of Magenta. This is an important point to note, as this can affect the overall appearance of the color.

Python Codes [To Verify]

Input

from turtle import *
screen = Screen()
screen.setup(400,400)
screen.bgcolor('#03124b')

The code above includes the Hex code that was discovered with the color picker.

Output

python code

To the right of the image, the color is visible. We verify the color as a dark shade of blue. It produced the color using the same Hex code provided by the front-end application.

Conclusion

As mentioned in many of the readings and literature about color print and color perception, increasing a certain variable such as Cyan to produce a darker blue instead of magenta to get purple can make a difference in digital graphic design multimedia such as images and photos. We used a Hex code in many variations of digital media, including front-end and back-end software products. Although the front-end manipulation of producing the dark blue color tone has become hidden, features available with a selected application program can do it. Features include layers, background, color tone manipulation, and so on. Increase the Cyan color tone to enhance the image in the best possible manner. In the end, there was a success in any visible purple shades within the image. We reached the goal to produce a dark blue shade without a hint of purple by reinforcing if the color was indeed a pure shade of blue.

Takeaways

The reader could have an enhanced understanding of:

  • Hex codes can become a common ground to communicate between front-end and back-end applications.
  • Kali Linux’s Kex is good to avoid display errors with Jupyter Notebook.
  • Turtle is a package module is installable with Kali Linux with pip3 and is a good Python tool when displaying Hex codes.
  • Cyber Link PhotoDirector 12 is a front-end application just like Adobe Photoshop and it is for photos and more.
  • The proper Hex code for dark blue is #03124b.

References

  1. https://help.lightningsource.com/hc/en-us/articles/211671103-Why-the-Color-Blue-Turns-Purple
  2. https://replicaprinting.com/2015/07/printing-blues/
  3. https://www.webucator.com/article/python-color-constants-module/
  4. https://projects.raspberrypi.org/en/projects/colourful-creations/1

Author Bio

My name is Priya Kalyanakrishnan, and I enjoy writing articles that involve some codes that may not become a lesson taught at school. My LinkedIn profile is here. I want to write articles similar to many that are published as a long-term opportunity.

The media shown in this article are not owned by Analytics Vidhya and are used at the Author’s discretion.

Frequently Asked Questions

Lorem ipsum dolor sit amet, consectetur adipiscing elit,

Responses From Readers

Clear

Computer Vision
Become a full stack data scientist