Code Monkey home page Code Monkey logo

vim-dichromatic's Introduction

Dichromatic

A dark colorscheme for color blind vimmers, but not only.


Humans are capable of perceiving a relatively large color spectrum thanks to special receptors in our retina called cones. Most of us have three types of cones to take care of the different wavelengths that compose visible light. That's called trichromia, it's the norm and most Vim colorschemes are designed against that norm.

Some of us — as much as 8% of the male population in some parts of the world — have a missing or damaged cone, however, which prevents them from perceiving some colors. That condition is called dichromia or, coloquially, color blindness.

Color blindness comes in many forms, depending on what cones are missing or damaged or even if we are talking rods, but the end result is always the same: the person gets confused pretty easily when colors are too close to each other or fall into one of their blind spots or if there's not enough contrast. If that wasn't enough, dichromia itself comes in three forms: protanopia, deuteranopia and tritanopia which have varying effects. Choosing the right colors is a difficult task when designing for "normal" vision but it should be apparent by now that designing for color blind users is at another level entirely.

Here is a screenshot of another theme of mine illustrating the problem:

Normal vision:

Normal vision

Tritanopia:

Tritanopia

The colors in Apprentice are nice and all for us "normals" but they are obviously less than optimal for someone with, say… tritanopia. The problem is not limited to Vim, of course: maps, charts, traffic lights and all kinds of information systems are routinely designed without any thought for dichromia but that shouldn't be a comforting thought. We can do better.

Thankfully, researchers across the world have been busy designing color palettes suitable for anybody, color blind or not. One such effort produced the palette I used as a basis for Dichromatic:

SRON palette

The image below shows the "final" palette used in Dichromatic, slightly modified from the colors above to fit in the standard xterm palette.

Dichromatic palette

And here are screenshots of dichomatic, first without filter, for color blind users to form their opinion, then with various filters applied, for users with normal vision to get an idea of how color blind users may see it:

Normal vision:

Normal vision

Deuteranopia (common):

Deuteranopia

Protanopia (rare):

Protanopia

Tritanopia (very rare):

Tritanopia

Configuration

This colorscheme is pretty much compatible with any reasonably recent Vim executed in any correctly set-up environment. "Compatible" in the sense that it will not break anything but it is only guaranteed to work the way it's supposed to work in GUI Vim (GVim, MacVim) and in TUI Vim in 256color-ready terminal emulators. 8color-ready and 16color-ready terminal emulators are not directly supported at the moment but they will. Stay tuned.

GVim/MacVim

GUI Vim is pretty much the bee's knees, colorscheme-wise, so there's nothing to do here.

256 colors terminal emulators

Make sure your terminal emulator correctly tells Vim that it is capable of displaying 256 colors. It is usually done by setting the TERM environment variable to something like xterm-256color or screen-256color. How to do that depends on your terminal emulator so you should read its documentation if you are unsure about the exact method.

Installation

Use your favorite plugin manager or drop dichromatic.vim into:

$HOME/.vim/colors/                on unix-like systems
%userprofile%\vimfiles\colors\    on Windows

Usage

Add the line below somewhere near the end of your vimrc:

colorscheme dichromatic

Hacking

The heavily commented template used for the creation of Dichromatic is available in the colors/ directory. Feel free to play with it and send pull requests.

Reference

vim-dichromatic's People

Contributors

romainl avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.