barista icon indicating copy to clipboard operation
barista copied to clipboard

Support for colors/markup

Open pinpox opened this issue 5 years ago • 2 comments

Hello,

I'm trying to recreate my old polybar configuration with barista. It looks like this:

2018-12-15-122141_4640x1200_scrot

Is it possible to add these colored underlines? I saw there is support for pango markup, but can't find any documentation on it. How can I set colors/icons/formatting?

Cheers,

Pablo

pinpox avatar Dec 15 '18 11:12 pinpox

Here's a brief write-up of pango on the website: barista.run/pango, and the godoc might also be useful. Feel free to send PRs to update any parts of the docs that aren't clear.

The underlines might not look exactly the same, since pango markup doesn't allow changing the width of the underline. But to get the volume output, for example, the code would be something like:

package main

import (
	"image/color"

	barista "barista.run"
	"barista.run/bar"
	"barista.run/modules/volume"
	"barista.run/pango"
	"barista.run/pango/icons/ionicons"
)

func main() {
	ionicons.Load("/home/Github/ionicons")
	barista.Run(
		volume.DefaultMixer().Output(func(v volume.Volume) bar.Output {
			return pango.Icon("ion-md-volume-high").
				AppendTextf("%d", v.Pct()).
				UnderlineLow().
				UnderlineColor(color.RGBA{0, 0, 0xab, 0xff})
		}),
	)
}

soumya92 avatar Dec 15 '18 18:12 soumya92

I'm currently working on getting some themes up and running, and as part of that I will probably end up with support for the i3-gaps version of i3bar, which has more border customisations. So it's likely that your screenshot could be provided as a theme once that work is done.

soumya92 avatar Dec 15 '18 19:12 soumya92