DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Join us tomorrow at 1 PM EST: "3-Step Approach to Comprehensive Runtime Application Security"
Save your seat
  1. DZone
  2. Data Engineering
  3. Databases
  4. Getting Terminal Colors Right

Getting Terminal Colors Right

Trevor Parsons user avatar by
Trevor Parsons
·
Dec. 20, 12 · Interview
Like (1)
Save
Tweet
Share
2.43K Views

Join the DZone community and get the full member experience.

Join For Free

This post is courtesy of Villiam Holub.

As a part of our work on ANSI escape code coloring, I looked in detail at default colors used in different command line terminals. It appears form the Wikipedia article that colors are set at their brightest level with minor variances across implementations:

Adapting these color schemes gives the result as in the following picture:

If you try to read the text very quickly, you’ll find it not exactly easy on the eyes. Actually it may hurt a little bit if you do so for a while. Also, looking at the text from a distance – some text lines clearly stands out (magenta, cyan) while others are hardly visible (yellow).

Default terminal colors do not take into account human perception of color brightness – luminance. So I spend some time looking around for a solution. There are various formulas found for luminance calculation, among them these:

  • 0.2126*R +0.7152*G +0.0722*B
  • 0.299*R + 0.587*G + 0.114*B
  • sqrt( 0.241*R^2 + 0.691*G^2 + 0.068*B^2)

As it turned out, only the last one works reasonably well. Taking into account the luminance, we have the following adjusted colors:

At first sight there is no real difference to what we had above. But there is. Here are both palettes next to each other:

Yellow is readable (although subtle) green stands out, cyan is darker. Look at the picture from distance. You will see how more coherent the right side is.

We decided to use the adapted palette. Although the colors are not as vivid as they could be, the colors can still be distinguished but more importantly they are now a lot more readable.

terminal

Published at DZone with permission of Trevor Parsons, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Using JSON Web Encryption (JWE)
  • Unleashing the Power of JavaScript Modules: A Beginner’s Guide
  • Using QuestDB to Collect Infrastructure Metrics
  • Public Cloud-to-Cloud Repatriation Trend

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: