Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting fonts to parts of modeline

How can I use multiple fonts in the modeline? For example, If want it to look like

Line: 23 Size: 3000

with Line and Size in a different font than the modeline font, how should

(setq-default mode-line-format '(
    "Line: %l Size: %i"
))

be modified?

like image 790
sawa Avatar asked Oct 10 '22 22:10

sawa


1 Answers

Use propertize. For example, to get Line: and Size: in bold as in your example:

(setq-default mode-line-format `(
    ,(propertize "Line:" 'face 'bold)
    " %l "
    ,(propertize "Size:" 'face 'bold)
    " %i"
))

You can use M-x list-faces-display to see samples of defined faces, or define your own.

For future reference, you can take a look at the documentation for any variable you're trying to customize with C-h v; the help for mode-line-format mentions using propertize.

like image 161
Nicholas Riley Avatar answered Oct 14 '22 01:10

Nicholas Riley