this post was submitted on 28 Nov 2023
1 points (100.0% liked)

Emacs

313 readers
2 users here now

A community for the timeless and infinitely powerful editor. Want to see what Emacs is capable of?!

Get Emacs

Rules

  1. Posts should be emacs related
  2. Be kind please
  3. Yes, we already know: Google results for "emacs" and "vi" link to each other. We good.

Emacs Resources

Emacs Tutorials

Useful Emacs configuration files and distributions

Quick pain-saver tip

founded 1 year ago
MODERATORS
 

I have a few newbie questions about theme customisation. In the doom-one-theme.el file, all of the colour definitions have 3 arguments, commented as being "default", "256", and "16".

  ;; name        default   256           16
  ((bg         '("#282c34" "black"       "black"  ))
   (fg         '("#bbc2cf" "#bfbfbf"     "brightwhite"  ))

My best guess is that these refer to colour depths, but I'm feeling a bit out of my depth here (hah!). My questions are as follows:

  1. How does Emacs decide which colour/depth to use?
  2. Are these fields all required, or are they customary/nice to have?
  3. Why are some colours hexes and others strings? Do the strings refer to some table somewhere with more hexes?

I would be extremely grateful for any clarity and/or links to relevant documentation where I can learn more!

Thanks

you are viewing a single comment's thread
view the rest of the comments
[–] MitchellMarquez42@alien.top 1 points 1 year ago

M-x list-colors-display shows all the valid color strings Emacs knows about in the current session.

Standard GUI Emacs and newer terminals like Alacritty can show All the colors (16 million), these are hex codes. Not all of them are named, but each name is associated with one hex color.

The 256 column is for terminals/displays that only show 256 colors, like gnome-terminal (i think. xterm-256color is a common terminal type for compatibility). These are named but the actual visual color values are set in the terminal config.

Likewise, 16 refers to original 16 color displays of later physical terminals. This is about the lower limit of colors to define for a visually distinct theme, for in my opinion. On some terminals/systems, the "bright" variants (8-16) are implemented as bolded forms of colors 0-7 respectively.

An example of an 8 color display is the Linux console, which you can reach with ctrl+alt+f4 or other function key between 2 and 6 inclusive on most Linux systems. Emacs does not look good on this display in most cases, but it's usable.