Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/r-lib/clisymbols

Unicode symbols for CLI applications, with fallbacks
https://github.com/r-lib/clisymbols

r

Last synced: 3 months ago
JSON representation

Unicode symbols for CLI applications, with fallbacks

Awesome Lists containing this project

README

        

```{r, setup, echo = FALSE, message = FALSE}
knitr::opts_chunk$set(
comment = "#>",
tidy = FALSE,
error = FALSE)
```

# clisymbols

[![R-CMD-check](https://github.com/r-lib/clisymbols/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/r-lib/clisymbols/actions/workflows/R-CMD-check.yaml)
[![](https://www.r-pkg.org/badges/version/clisymbols)](https://www.r-pkg.org/pkg/clisymbols)
[![CRAN RStudio mirror downloads](https://cranlogs.r-pkg.org/badges/clisymbols)](https://www.r-pkg.org/pkg/clisymbols)
[![Codecov test coverage](https://codecov.io/gh/r-lib/clisymbols/branch/main/graph/badge.svg)](https://app.codecov.io/gh/r-lib/clisymbols?branch=main)

> Unicode symbols with Windows fallbacks

![](/screenshot.png)

Inspired by (and mostly copied from) the
[figures](https://github.com/sindresorhus/figures) JavaScript project.

## Install

Stable version:

```{r eval = FALSE}
install.packages("clisymbols")
```

Development version:

```{r eval = FALSE}
pak::pak("r-lib/clisymbols")
```

## Usage

```{r}
library(clisymbols)
cat(symbol$tick, "All good\n")
cat(symbol$cross, "Problem\n")
```

Here is a list of all symbols, with their names:

```{r}
for (i in seq_along(symbol)) {
cat(symbol[[i]], "\t", names(symbol)[i], "\n", sep = "")
}
```

### Fallback symbols

Some terminals do not support (all) Unicode characters, and on these reasonable
ASCII substitutes are used:

```{r echo = FALSE}
for (i in seq_along(clisymbols:::symbol_win)) {
cat(format(clisymbols:::symbol_win[[i]], width = 4),
names(clisymbols:::symbol_win)[i], "\n", sep = "")
}
```

# License

MIT © [Gabor Csardi](https://gaborcsardi.org) and [Sindre Sorhus](https://sindresorhus.com)