Closed pierre-lecocq closed 9 years ago
After some quick tests, it appears that the :foreground and :background properties of `image' are ignored on Mac OS X.
I tried on GNU/Linux (Debian), it worked, of course.
This is harsh.
hmm, how about using xpm images instead of xbm ?
if it works on OS X, adding option like symon-sparkline-use-xpm
seems reasonable.
I'll try this, @zk-phi. Gimme a little bit of time and I'll drop a line here. Thanks
here's a sparkline -> xpm converter function.
(defun sparkline->xpm (sparkline)
(let ((data (plist-get (cdr sparkline) :data)))
(print data)
(with-temp-buffer
(insert (format "/* XPM */
static char * sparkline_xpm[] = { \"%d %d 2 1\", \"@ c %s\", \". c none\""
symon-sparkline-width
symon-sparkline-height
(face-foreground 'default)))
(dotimes (ix (* symon-sparkline-width symon-sparkline-height))
(when (zerop (mod ix symon-sparkline-width)) (insert ",\n\""))
(insert (if (aref data ix) "@" "."))
(when (zerop (mod (1+ ix) symon-sparkline-width)) (insert "\"")))
(insert "};")
`(image :type xpm :data ,(buffer-string) :ascent ,symon-sparkline-ascent
:height ,symon-sparkline-height :width ,symon-sparkline-width))))
does this work ? (insert-image (sparkline->xpm (symon--make-sparkline '(0 50 100))))
Yes it does !
wow! okay, I'll add the option soon.
Thanks @zk-phi !
committed.
Tested. And approved. Works like a charm.
Thanks @zk-phi ! (sorry for the delay, I just finished my day of work. You were faster than me :))
(for the record, I'll try to manage it ASAP)
I've tried solarized-dark and had no problems (color of sparklines inherits 'default face). It may be an environment-dependent problem.
We can probably fix that by just adding :foreground and :background properties to sparklines. can you try this ?