r-lib / cli

Tools for making beautiful & useful command line interfaces
https://cli.r-lib.org/
Other
654 stars 70 forks source link

Tweaking `cli::col_h1()` styling #696

Open olivroy opened 5 months ago

olivroy commented 5 months ago

I am wondering if it was possible to make this output with cli::cli_h1()

image

cli::cli_h1(cli::col_yellow("GP goodpractice"))

Almost does it, but it doesn't affect the line.

I tried playing with https://cli.r-lib.org/reference/themes.html#examples, but it doesn't really work.

I am wondering if docs could be enhanced generally for the id and class arguments. More examples on how to create custom theming of elements would be great!

I'd be happy to make some doc edits, but I can't figure out how things work at the moment..

Using cli::rule(left = "aa", right = "a", col = "yellow") works

gaborcsardi commented 5 months ago

Currently you need to change the fmt property in the theme of h1 to achieve this. Example: https://github.com/r-lib/cli/blob/b7f8259b382546ed186b2ee7da2b4d6809e6155a/R/themes.R#L106