barista icon indicating copy to clipboard operation
barista copied to clipboard

Themes!

Open soumya92 opened this issue 6 years ago • 1 comments

Requires more hooks into barista core, since there's not enough information available outside core for some of the more interesting themes (e.g. powerline) that have special interactions at segment borders.

This can be added without breaking compat. The default theme could just do what core does today.

The simplest API would be

type Theme func([]map[string]interface{}) []map[string]interface{}

which would give themes complete control over the output, but at the cost of having to parse colours if they need to blend or tint them. It also exposes the internal "name" of each segment/module to the theme.

A better API might be

type Theme func([]bar.Segment) []bar.Segment

but that would require storing bar.Segment instead of the pre-serialised map for each module's last output. Of course, depending on the speed of serialisation, this may be a non-issue.

soumya92 avatar May 30 '18 00:05 soumya92

Themes may also want the grouping for modules that emit multiple segments, so maybe the signature should be

type Theme func([][]bar.Segment) []bar.Segment

although this has the disadvantage of making a nop theme harder.

soumya92 avatar May 30 '18 00:05 soumya92