Last active
March 15, 2021 17:36
-
-
Save phgrosjean/fc7cc94855bbb197202e03bc5c23933e to your computer and use it in GitHub Desktop.
[R config using colorout]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ttyConfig <- function(prompt = "R", col = 7) { | |
| if (isColorXterm()) { | |
| ## This is a scheme assuming black text on white background | |
| colorout::setOutputColors256(normal = c(0, 0, 238), number = c(0, 0, 0), | |
| negnum = c(0, 0, 88), zero = c(0, 0, 202), date = c(0, 0, 22), | |
| string = c(0, 0, 17), const = c(0, 0, 54), false = c(0, 0, 202), true = 22, | |
| infinite = c(0, 0, 202), stderror = 1, warn = c(1, 0, 1), error = c(1, 0, 1), | |
| verbose = FALSE, zero.limit = .Machine$double.xmin) | |
| } | |
| ## Colorize also the prompt and add a line before it | |
| #prmpt <- "\u26aa " | |
| if (nchar(prompt) < 2) prompt <- paste0(prompt, " ") | |
| col <- as.integer(col)[1] | |
| options(prompt = paste(c("\u001b[4;", 30 + col, "m", rep(" ", 80), | |
| "\u001b[0m\n\u001b[1;", 40 + col, "m", prompt, "\u25b8\u001b[0m "), collapse = "")) | |
| #options(continue = "\u26ab + ") | |
| options(continue = paste0("\u001b[4;", 40 + col, "m \u001b[0;", 40 + col, "m \u001b[0m ")) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment