Skip to content

schemes

D Groth edited this page Oct 12, 2024 · 6 revisions

Editor Schemes / Themes

MicroEmacs comes with around 30 predefined editor schemes. Often you would like to add your own editor scheme either by modifying an existing scheme or by importing an already defined editor scheme from an other application into MicroEmacs. There are a few ways to accomplish this:

  • modify and existing scheme by using the scheme-editor interface from within ME, see the help page for scheme-editor
  • importing an editor scheme from other application - see the notes below
  • create a simple scheme macro with color definitions - see notes below

There is a big difference between the color display in a terminal and a color display in the GUI version. The explanations below are related to the GUI version of MicroEmacs. For the terminal version you might use the default "White on Black" theme and then use either your terminal emulator to change the colors or use color definition in shell scripts which can be found in the [dynamic colors folder][https://github.com/mbadolato/iTerm2-Color-Schemes/tree/master/dynamic-colors] of the mbadolato/iTerm2-Color-Schemes then execute MicroEmacs terminal version in that terminal. This works best with the dark color schemes.

But now some hints for the GUI version mainly.

Importing Editor Schemes / Themes

The Github project mbadolato/iTerm2-Color-Schemes contains by far the largest collection of color themes for different applications as far as I know.

One of the formats in which themes are converted there is the xrdb format. The MicroEmacs Github project provides a xrdb-scheme macro in the contribs directory which allows directly to use the xrdb-files.

To install this macro download the file xrdb.emf to your ~/.config/jasspa folder and add the following line to your USERNAME.emf file.

define-macro-file xrdb xrdb-scheme

After you executed the buffer USERNAME.emf (Esc x execute-buffer) the xrdb-scheme command should be available. Thereafter you need to downlod files from the xrdb folder and place them in a folder ~/.config/jasspa/themes - please remove any spaces in the file names as they lead to trouble usually. After you then execute the xrdb-scheme command you can interactively select the themes which were placed within the folder.

Please note, that these xrdb-schemes can't be changed in the scheme-editor interface.

Editor scheme macros

An other alternative might be to define a macro which loads the color definitions. Supported here are 21 colors which are using the Ayu Light and Dark schemes for the assignments of colors to certain display items. An color-scheme macro placed in your USERNAME.emf file could look like this.

define-macro scheme-artur
    ; dark scheme using "Ayu Dark" as template
    execute-file "schemead"
    ;                      red green blue
    add-color &set .col1 1 61 53 42        ; Ansi_0  Black
    add-color &set .col2 2 205 92 92       ; Ansi_1  Red
    add-color &set .col3 3 134 175 128     ; Ansi_2  Green
    add-color &set .col4 4 232 174 91      ; Ansi_3  Yellow
    add-color &set .col5 5 100 149 237     ; Ansi_4  Blue
    add-color &set .col6 6 222 184 135     ; Ansi_5  Purple
    add-color &set .col7 7 176 196 222     ; Ansi_6  Cyan
    add-color &set .col8 8 187 170 153     ; Ansi_7  White
    add-color &set .col9 9 85 68 68        ; Ansi_8  Bright Black
    add-color &set .col10 10 204 85 51     ; Ansi_9  Bright Red
    add-color &set .col11 11 136 170 34    ; Ansi_10 Bright Green
    add-color &set .col12 12 255 167 93    ; Ansi_11 Bright Yellow
    add-color &set .col13 13 135 206 235   ; Ansi_12 Bright Blue
    add-color &set .col14 14 153 102 0     ; Ansi_13 Bright Purple
    add-color &set .col15 15 176 196 222   ; Ansi_14 Bright Cyan
    add-color &set .col16 16 221 204 187   ; Ansi_15 Bright White
    add-color &set .col17 17 28 28 28      ; Background
    add-color &set .col18 18 221 238 221   ; Foreground
    add-color &set .col19 19 226 187 239   ; Cursor
    add-color &set .col20 20 77 77 77      ; Selection Background
    add-color &set .col21 21 255 255 255   ; Selection Foreground  
    screen-update
!emacro

define-macro scheme-belafonte-day
  ; light scheme using "Ayu Light as template
  execute-file "schemeal" ; Ayu Light
  ;                      red green blue
  add-color &set .col1 1 32 17 27         ; Ansi_0  Black         
  add-color &set .col2 2 190 16 14        ; Ansi_1  Red           
  add-color &set .col3 3 133 129 98       ; Ansi_2  Green         
  add-color &set .col4 4 234 165 73       ; Ansi_3  Yellow        
  add-color &set .col5 5 66 106 121       ; Ansi_4  Blue          
  add-color &set .col6 6 151 82 44        ; Ansi_5  Purple        
  add-color &set .col7 7 152 154 156      ; Ansi_6  Cyan          
  add-color &set .col8 8 150 140 131      ; Ansi_7  White         
  add-color &set .col9 9 94 82 82         ; Ansi_8  Bright Black  
  add-color &set .col10 10 190 16 14      ; Ansi_9  Bright Red    
  add-color &set .col11 11 133 129 98     ; Ansi_10 Bright Green  
  add-color &set .col12 12 234 165 73     ; Ansi_11 Bright Yellow 
  add-color &set .col13 13 66 106 121     ; Ansi_12 Bright Blue   
  add-color &set .col14 14 151 82 44      ; Ansi_13 Bright Purple 
  add-color &set .col15 15 152 154 156    ; Ansi_14 Bright Cyan   
  add-color &set .col16 16 213 204 186    ; Ansi_15 Bright White  
  add-color &set .col17 17 213 204 186    ; Background            
  add-color &set .col18 18 69 55 60       ; Foreground            
  add-color &set .col19 19 69 55 60       ; Cursor                
  add-color &set .col20 20 150 140 131    ; Selection Background  
  add-color &set .col21 21 69 55 60       ; Selection Foreground  
  screen-update
!emacro

If you place these macros into your USERNAME.emf file you can execute them at any time. You can as well change the colors in the range 0-255 to adapt them to your personal preferences.

Below an image of the editor session after executing the scheme-artur command.

Clone this wiki locally