A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/s-fleck/colt below:

s-fleck/colt: CLI color themes for R

Colt - CLI color themes for R

Colt is aimed at package developers that want to create themeable command line output. It is a simple wrapper around the crayon package.

A colt theme is created with the colt_theme() constructor. A colt theme is just a list of functions that get applied to the text. A print method exists for previewing themes. Colt styles are named semantically rather than directly with a color (e.g. "yes" instead of "green").

The acitive theme is stored in options("colt.theme"). It can easily be changed with colt::set_theme(). Colt comes with two default themes, colt_theme_light and colt_theme_dark.

fancy <- function(x) {cat(
  colt::clt_h1("Fancy text themes\n"),
  colt::clt_h2("provided by the colt package\n\n"),
  colt::clt_chr("By specifying a few"), clt_chr_accent("design elements"), 
  clt_chr("it is easy to assign new themes to cli text\n"),
  colt::clt_chr("Do you agree?\n\n"),
  colt::clt_true("I agree\n"),
  colt::clt_false("I don't agree\n"),
  colt::clt_maybe("I don't know\n"),
  colt::clt_chr_subtle("I don't care\n")
)}
colt::set_theme(colt::clt_theme_light)
fancy()

colt::set_theme(colt::clt_theme_dark)
fancy()

You can use colt::set_theme(colt::colt_theme()) to set an empty theme (= switch off colors).


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4