nordtheme / xresources

An arctic, north-bluish clean and elegant Xresources color theme.
https://www.nordtheme.com/ports/xresources
MIT License
313 stars 42 forks source link

Undefined color nord0 #9

Open cimm opened 4 years ago

cimm commented 4 years ago

I am seeing the following error when I launch Vim via the terminal (well, I see it when I close Vim but I guess it's loaded when opening it). I am using Gnome Terminal with the .Xresources file from nord-xresources.

Warning: Color name "nord0" is not defined

It's related to line 27 line in the .Xresources file: *.background: nord0 but I can't tell what's wrong with that, the color is correctly defined higher up in the same file.

Any ideas?

arcticicestudio commented 4 years ago

Hi @cimm, this sounds like a weird bug and also includes three possible sources that might cause the problem. I did a quick research and found some other bug reports in different projects as well as the Ubuntu ticket system. The problem described in https://github.com/w0ng/vim-hybrid/issues/3 comes very close to your description. It looks like this might be caused by a change in one of the newer Ubuntu releases where the GNOME Display Manager /etc/gdm/Xsession (package gdm3) is configured to load the ~/.Xresources files using the -nocpp flag which disables the loading of #define statements. So it reads the first line (which is actually nord0) and fails due to the this parser configuration. Looks like a tricky root cause where someone spend a lot of time debugging the data flow :open_mouth:

Anyway, the solution for your problem is relatively simple:

  1. There is absolute no need for you to use or even create the ~/.Xresources file when using GNOME terminal. It won't even look after this file since it stores it configuration via Gsettings. The .Xresources is more a kind of relic from older terminals like xterm that, like the name states, is part of the X Window System. To use Nord with GNOME terminal you can simply install the official Nord GNOME Terminal theme instead and you're ready to go with all the colors.
  2. To prevent the warning message to show up you can simply delete, rename or move the ~/.Xresources file provided you're not using it for other X apps or terminals for sure.
  3. To use Nord for Vim you can again install the official Nord Vim port project and it'll automatically use the colors provided by the Nord GNOME Terminal theme you've installed in step 2.

I hope this helps to understand the root cause and fixes the problem on your side. Let me know if there are other problems or when its working for you.

jonassvedas commented 4 years ago

A hack to get this working for those who use xterm: you can preprocess the resources file yourself with a C compiler. Source: https://bbs.archlinux.org/viewtopic.php?id=230696

cpp -P .Xresources > /tmp/xres
xrdb -merge /tmp/xres