rougier / svg-lib

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

SVG in header/mode line example #22

Closed darth-cheney closed 1 year ago

darth-cheney commented 1 year 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 1 year 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 1 year ago

Excellent, that works great. Thanks

darth-cheney commented 1 year 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 1 year ago

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