Skip to content

Instantly share code, notes, and snippets.

Last active February 23, 2024 00:13
Show Gist options
  • Save llinfeng/4000131dbfd6d37831aa3b3b135e91ae to your computer and use it in GitHub Desktop.
Save llinfeng/4000131dbfd6d37831aa3b3b135e91ae to your computer and use it in GitHub Desktop.
Tuning colorization of Vim for E-ink display
function! Dasung() " Specify a readable color scheme.
" Set color scheme, so that mostly things are readable
colorscheme delek
" Tune the airline color scheme (feel free to take it away).
AirlineTheme zenburn
" Keep the cursor as HD-FT has touch input
set guioptions+=r
" I got my copy of ProFontWindows, likely, from here:
" Resolution for the 13-inch Paperlike HD display is 1400 x 1050
set guifont=ProFontWindows:h20
" Note: font on Dasung is calibrated. Need to make the screen max
set background=light
" denote the current line of the cursor.
set cursorline
" let g:airline_theme = 'zenburn'
hi! link airline_tabfill VertSplit
hi CursorLine guibg=lightblue
" Highlighting for search pattern
hi Search guifg=White guibg=black
" Highlighting for Folded code block
hi Folded guibg=LightYellow
" Colorization for Visual Mode
hi Visual guifg=White guibg=Black gui=none
" Character under the cursor
hi Cursor guifg=Blue guibg=lightred gui=none
" Sign column
hi SignColumn guibg=White gui=none
" Sign Marker column
hi SignatureMarkText guifg=White guibg=LightBlue gui=none
" ColorColumn (as the 80 char divider)
hi ColorColumn ctermbg=lightred guibg=lightred
" Matching parameters, and vimtex matching environments.
hi MatchParen guibg=NONE guifg=blue gui=bold
" Send the Vim session to full screen.
" Fullscreen
" Undo highlights for TODO
hi! link Todo Comment
" Cursor, in a light color: avoiding the traces.
" highlight iCursor guifg=Black guibg=LightYellow
" set guicursor+=i:ver25-iCursor
" set guicursor+=i:blinkwait10
Copy link

llinfeng commented Aug 15, 2017

Dasung is a company that produces E-ink displays. Yes, such monitor is only capable of handling black and white colors.
Well, maybe something more ---- the range of gray-scale colors that are in between.

The gist defines a function that I feel proud of, which helps with using Vim on an E-ink display. It may cast the colorization of Vim into something rather weird on a LED screen. However, the adjusted colorization does most of the syntax highlighting correct.

Copy link

llinfeng commented Jun 18, 2020

Got a new Paperlike HD-FT, with solid touch input. Adjusted the script for usability on the HD-FT model (gray-scales were improved/changed as compared to the older Paperlike Pro model from 2017).

When calibrating the color schemes, :runtime syntax/colortest.vim is super helpful. The workflow of fine-tuning the color scheme, include:

  1. Call the Dasung() function to apply the existing tweaks;
  2. Run :runtime syntax/colortest.vim to open up a buffer with a good collection of color combinations for foreground/background colors. Pick the color that appears to be readable on the e-ink display.

Copy link

rbozan commented May 11, 2021

Hi, I was wondering how the above config looks like on an e-ink screen? Could you take a picture of the screen with above config please?

Copy link

llinfeng commented May 11, 2021

Here is how the color profile looks like for rendering a simple help file. The original goal was to make the thing readable. On e-ink displays, there is not much to expect as the contrast level will easily distort readability.

Copy link

@rbozan, the old link from 2017 also works.

Copy link

rbozan commented May 12, 2021

@rbozan, the old link from 2017 also works.

Ah sorry, I didn't notice. Thank you.

I was considering to buy an e-ink display, what do you think about it? Do you prefer it over the normal displays?

Copy link

Per my own usage, I only prefer to use the e-ink monitor for long reading/writing sessions. For writing, I use the customized color scheme in this gist in Vim, and type along for hours. For reading, I use Calibre Viewer to read EPUB/mobi books (this viewer allows for batch-exporting the highlights and notes). I usually pull for such sessions when my eyes "burn" after using those "normal LCD monitors" for a prolonged period of time.

Compared to my "normal monitors", the e-ink monitor is simply too small. In portrait mode, I can fit at most 60 lines with comfortable font-size. In landscape mode, there are 35 lines or so. Since tuning the syntax highlighting can only do as much with the limited gray scale levels, I hardly find myself writing any code on the e-ink monitor. Even with the perfectly tuned colorscheme, my eyes can only tell a very limited amount of gray scales.

Dasung, the company that made the e-ink monitor in the screenshot, is selling a larger 25-inch e-ink monitor. I haven't been able to get my hands on it as it is currently only sold in China.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment