rougier / svg-lib

Emacs SVG libraries for creatings tags, icons and bars
GNU General Public License v3.0
343 stars 31 forks source link

SVG in header/mode line example #22

Closed darth-cheney closed 2 years ago

darth-cheney commented 2 years ago

Can you add an example where you put, say, an svg progressbar indicating the cursor position in the header or modeline? In particular I'm interested in how this could be combined with nano-modeline

rougier commented 2 years ago

If you insert the string below in the modeline, it should work:

(propertize "Progress"
            'display (svg-lib-progress-bar .5 nil :width 9 :margin 1 :stroke 2 :padding 2))
darth-cheney commented 2 years ago

Excellent, that works great. Thanks

darth-cheney commented 2 years ago

Just wanted to follow up: I'm able to use the circular progress indicator to give me some sense of the cursor's position in a document (inside of nano-mode-line):

Screen Shot 2022-08-02 at 6 08 31 PM

Works pretty well, though I'm not sure why there is extra space to the right

rougier commented 2 years ago

The regular string that is used to display the icon need to have the same width (2 spaces in that case)