Skip to content
This repository has been archived by the owner on May 30, 2024. It is now read-only.

Support for colors/markup #54

Open
pinpox opened this issue Dec 15, 2018 · 2 comments
Open

Support for colors/markup #54

pinpox opened this issue Dec 15, 2018 · 2 comments

Comments

@pinpox
Copy link

pinpox commented Dec 15, 2018

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

@soumya92
Copy link
Owner

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
Copy link
Owner

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants