crayon

🖍️ R package for colored terminal output — now superseded by cli

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

Science Score: 36.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • â—‹
    CITATION.cff file
  • âś“
    codemeta.json file
    Found codemeta.json file
  • âś“
    .zenodo.json file
    Found .zenodo.json file
  • â—‹
    DOI references
  • â—‹
    Academic publication links
  • âś“
    Committers with academic emails
    2 of 18 committers (11.1%) from academic institutions
  • â—‹
    Institutional organization owner
  • â—‹
    JOSS paper metadata
  • â—‹
    Scientific vocabulary similarity
    Low similarity (15.1%) to scientific vocabulary

Keywords

r

Keywords from Contributors

package-creation visualisation travis-ci tidyverse codecov coverage coverage-report data-manipulation grammar curl
Last synced: 10 months ago · JSON representation

Repository

🖍️ R package for colored terminal output — now superseded by cli

Basic Info
Statistics
  • Stars: 325
  • Watchers: 6
  • Forks: 39
  • Open Issues: 0
  • Releases: 7
Topics
r
Created almost 12 years ago · Last pushed about 1 year ago
Metadata Files
Readme Changelog License Code of conduct

README.md

🚀 crayon is now superseded by the cli package. 🚀

Please use cli for new projects.

crayon is still supported and will receive important bug fixes, but no new features.



crayon


Stylish terminal output in R

Lifecycle: superseded CRAN RStudio mirror downloads R-CMD-check Codecov test coverage <!-- badges: end -->

With crayon it is easy to add color to terminal output, create styles for notes, warnings, errors; and combine styles.

ANSI color support is automatically detected and used. Crayon was largely inspired by chalk.

Installation

Stable version:

r install.packages("crayon")

Development version:

r pak::pak("r-lib/crayon")

Styles

Crayon defines several styles that can be combined. Each style in the list has a corresponding function with the same name.

General styles

  • reset
  • bold
  • blurred (usually called dim, renamed to avoid name clash)
  • italic (not widely supported)
  • underline
  • inverse
  • hidden
  • strikethrough (not widely supported)

Text colors

  • black
  • red
  • green
  • yellow
  • blue
  • magenta
  • cyan
  • white
  • silver (usually called gray, renamed to avoid name clash)

Background colors

  • bgBlack
  • bgRed
  • bgGreen
  • bgYellow
  • bgBlue
  • bgMagenta
  • bgCyan
  • bgWhite

Screenshot on OSX

Usage

The styling functions take any number of character vectors as arguments, and they concatenate and style them:

r library(crayon) cat(blue("Hello", "world!\n"))

Crayon defines the %+% string concatenation operator to make it easy to assemble strings with different styles.

r cat("... to highlight the " %+% red("search term") %+% " in a block of text\n")

Styles can be combined using the $ operator:

r cat(yellow$bgMagenta$bold('Hello world!\n'))

Styles can also be nested, and then inner style takes precedence:

r cat(green( 'I am a green line ' %+% blue$underline$bold('with a blue substring') %+% ' that becomes green again!\n' ))

It is easy to define your own themes:

r error <- red $ bold warn <- magenta $ underline note <- cyan cat(error("Error: subscript out of bounds!\n")) cat(warn("Warning: shorter argument was recycled.\n")) cat(note("Note: no such directory.\n"))

256 colors

Most modern terminals support the ANSI standard for 256 colors, and you can define new styles that make use of them. The make_style function defines a new style. It can handle R's built in color names (see the output of colors()) as well as RGB specifications via the rgb() function. It automatically chooses the ANSI colors that are closest to the specified R and RGB colors, and it also has a fallback to terminals with 8 ANSI colors only.

r ivory <- make_style("ivory") bgMaroon <- make_style("maroon", bg = TRUE) fancy <- combine_styles(ivory, bgMaroon) cat(fancy("This will have some fancy colors"), "\n")

License

MIT @ Gábor Csárdi

Owner

  • Name: R infrastructure
  • Login: r-lib
  • Kind: organization

GitHub Events

Total
  • Issues event: 4
  • Watch event: 4
  • Delete event: 1
  • Issue comment event: 1
  • Push event: 3
  • Pull request event: 1
  • Fork event: 1
  • Create event: 1
Last Year
  • Issues event: 4
  • Watch event: 4
  • Delete event: 1
  • Issue comment event: 1
  • Push event: 3
  • Pull request event: 1
  • Fork event: 1
  • Create event: 1

Committers

Last synced: 12 months ago

All Time
  • Total Commits: 305
  • Total Committers: 18
  • Avg Commits per committer: 16.944
  • Development Distribution Score (DDS): 0.174
Past Year
  • Commits: 9
  • Committers: 2
  • Avg Commits per committer: 4.5
  • Development Distribution Score (DDS): 0.111
Top Committers
Name Email Commits
Gábor Csárdi c****r@g****m 252
brodieG b****G 26
Jim Hester j****r@g****m 6
Kirill MĂĽller k****r 5
Salim B 2****b 3
Ista Zahn i****n@h****u 1
Romain François r****n@t****r 1
Chan-Yub Park m****k@g****m 1
David Nusinow d****w@g****m 1
Davis Vaughan d****s@p****o 1
Davor Cubranic c****c@s****a 1
Eamon O'Dea o****5@g****m 1
Francois Michonneau f****u@g****m 1
Maximilian MĂĽcke m****n@g****m 1
Neal Fultz n****z@g****m 1
Ramon Diaz-Uriarte r****2 1
Rich FitzJohn r****n@g****m 1
Vince v****r 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 81
  • Total pull requests: 29
  • Average time to close issues: 3 months
  • Average time to close pull requests: about 2 months
  • Total issue authors: 48
  • Total pull request authors: 20
  • Average comments per issue: 3.1
  • Average comments per pull request: 2.76
  • Merged pull requests: 25
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 3
  • Pull requests: 3
  • Average time to close issues: 27 days
  • Average time to close pull requests: 34 minutes
  • Issue authors: 2
  • Pull request authors: 2
  • Average comments per issue: 0.33
  • Average comments per pull request: 0.33
  • Merged pull requests: 3
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • gaborcsardi (19)
  • brodieG (5)
  • krlmlr (3)
  • hadley (3)
  • HenrikBengtsson (3)
  • january3 (2)
  • SchmidtPaul (2)
  • pbreheny (2)
  • jennybc (2)
  • kforner (2)
  • zx8754 (1)
  • lindauer (1)
  • M-E-Rademaker (1)
  • ktiu (1)
  • dbosak01 (1)
Pull Request Authors
  • gaborcsardi (6)
  • salim-b (3)
  • krlmlr (3)
  • jimhester (2)
  • m-muecke (2)
  • brodieG (2)
  • richfitz (1)
  • cubranic (1)
  • nfultz (1)
  • fmichonneau (1)
  • vreuter (1)
  • dnusinow (1)
  • tiegz (1)
  • dgkf (1)
  • rdiaz02 (1)
Top Labels
Issue Labels
bug (11) upkeep (4) reprex (3) feature (1) tidy-dev-day :nerd_face: (1)
Pull Request Labels

Packages

  • Total packages: 3
  • Total downloads:
    • cran 774,453 last-month
  • Total docker downloads: 212,578,013
  • Total dependent packages: 576
    (may contain duplicates)
  • Total dependent repositories: 1,644
    (may contain duplicates)
  • Total versions: 30
  • Total maintainers: 1
cran.r-project.org: crayon

Colored Terminal Output

  • Versions: 15
  • Dependent Packages: 488
  • Dependent Repositories: 1,545
  • Downloads: 774,453 Last month
  • Docker Downloads: 212,578,013
Rankings
Downloads: 0.2%
Dependent packages count: 0.2%
Dependent repos count: 0.3%
Stargazers count: 1.2%
Forks count: 2.1%
Average: 3.6%
Docker downloads count: 17.3%
Maintainers (1)
Last synced: 11 months ago
proxy.golang.org: github.com/r-lib/crayon
  • Versions: 7
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.4%
Average: 5.6%
Dependent repos count: 5.8%
Last synced: 11 months ago
conda-forge.org: r-crayon
  • Versions: 8
  • Dependent Packages: 88
  • Dependent Repositories: 99
Rankings
Dependent packages count: 0.9%
Dependent repos count: 3.4%
Average: 13.6%
Stargazers count: 21.8%
Forks count: 28.4%
Last synced: 11 months ago

Dependencies

DESCRIPTION cran
  • grDevices * imports
  • methods * imports
  • utils * imports
  • mockery * suggests
  • rstudioapi * suggests
  • testthat * suggests
  • withr * suggests
.github/workflows/R-CMD-check.yaml actions
  • actions/checkout v3 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pkgdown.yaml actions
  • JamesIves/github-pages-deploy-action v4.4.1 composite
  • actions/checkout v3 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pr-commands.yaml actions
  • actions/checkout v3 composite
  • r-lib/actions/pr-fetch v2 composite
  • r-lib/actions/pr-push v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/test-coverage.yaml actions
  • actions/checkout v3 composite
  • actions/upload-artifact v3 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite