Skip to content

Messages should not print in red text #2574

Closed

Description

@hadley

screen shot 2018-04-03 at 8 25 29 am

Display with red text makes errors look like they are problems, when they are often just informative. It also makes it difficult to style messages with crayon because we don't know what the default text colour will be.

Activity

  1. jimhester commented on Apr 3, 2018

    @jimhester
    Contributor

    Alternatives to coloring in red would be using bold, as is done by R by default in the macOS terminal, or doing nothing as is done on linux systems.

  2. kevinushey commented on Apr 3, 2018

    @kevinushey
    Collaborator

    Note that the issue is ultimately that all stderr() output is colored like that:

    screen shot 2018-04-03 at 8 46 32 am

    Do you think we should attempt out color message() output distinctly from stderr() output?

  3. hadley commented on Apr 3, 2018

    @hadley
    MemberAuthor

    I think stderr and message() should be formatted consistently - stderr is generally for diagnostic messages, and not just errors.

    Warnings and errors should continue to print in red however.

  4. jimhester commented on Apr 3, 2018

    @jimhester
    Contributor

    Differentiating between message() warning() stop() and stderr() would be a great thing to have especially if you don't have to change the text formatting. E.g. maybe a colored flag next to the text or something similar

    screenshot 2018-04-03 11 55 22

    Note we will have the same issues with generating colored warnings and errors if they are continued to be colored red, so it is something to keep in mind.

  5. jjallaire commented on Apr 3, 2018

    @jjallaire
    Member

    I believe that right now R only tags output as "normal" or "error", and stderr, warnings, and R errors all get the error treatment.

    If we wanted to be more granular than that I think we'd need to explicitly overwrite the message() and warning() functions in the base package (even then we wouldn't catch warnings generated from native code so there would be some inconsistency of presentation).

    I think the point about red being a bit too harsh for all these conditions is a good one. While I agree that it would be great to have 4 different colors, if we can't achieve that (and I don't think we can without some major hacking) then softening the default red presentation seems like a good idea.

  6. randomgambit commented on Oct 17, 2018

    @randomgambit

    amazing idea guys. You cant imagine how many times I missed that my code chunk actually didnt do anything because I didnt see that error line pop up among the output. Having errors in RED would be really useful!

  7. breckuh commented on Oct 30, 2018

    @breckuh

    This really would be amazing. Like @randomgambit mentioned, I often don't catch an error message because I've learned to ignore most red text in the console. I also waste time scanning through information searching for errors. This is my number 1 complaint about the UX in RStudio (Well, this is my number 2 complaint--my first complaint is that RStudio can't automatically fix my bugs, analyze my data for significant findings, and submit these findings to journals). Ignoring most of the red text in the console is very counter intuitive to anyone coming from another programming language.

    The red is also very distracting in Jupyter. In the example below, my notebook looks like the Red Sea. In this example I know I could use "warn.conflicts" or "suppressPackageStartupMessages" to clean up the red, or click "hide outputs" everytime I run the cell, but adding ~4 tokens per line seems like a waste of effort to hide some red. I like to use "conflicted" to only alert me to an error when there potentially is one.

    screenshot from 2018-10-30 13-14-59

    I think a convention around messages to stderr that could be parsed to format appropriately would be great. Or whatever you decide--I'm not familiar yet with the R/Rstudio internals.

    UPDATE: I have since started playing with RMarkdown notebooks, which are awesome and have other ways of dealing with the red problems. But still, would be nice...

  8. gtritchie commented on Apr 19, 2019

    @gtritchie
    Member

    Using color as the only way to communicate something in the UI is an accessibility no-no as it is invisible to screen readers, those with color-blindness, and so forth.

    If we do something like this, we need to make sure the information is "visible" to screen readers, and to sighted users who can't distinguish colors. Flagging as a (potential) accessibility issue so this gets considered should we do some work on this.

  9. katrinleinweber commented on Mar 8, 2020

    @katrinleinweber

    Warnings and errors should continue to print in red however

    Please re-consider this in case of warnings. As an instructor to new R(studio) learners, I often get worried questions why this or that "didn't work" (e.g. installing packages on Windows without Rtools preset). Most often, checking what the problem could be reveals that they misinterpreted some red warning.

    Yes, that's a good lesson in actually reading console output, but an unnecessary source of confusion. Orange would be neat :-)

  10. daattali commented on Jun 2, 2020

    @daattali
    Contributor

    @gtritchie I think you bring up a very similar, but perhaps separate issue. Accessibility of the colours and getting information from the colours is one issue.

    There is also another issue that is very important: currently messages are red, which means that for any sighted non-colour-blind beginner user, they think something went wrong. Simply removing all colour would even be a better alternative at the moment for this issue specifically. Every time I teach a new group of people R, a few of them tell me that everything is failing just because they see all the red messages and assume that red = fail. So I would argue this red messages issue needs to be addressed as a high priority because it is a deterrent to a majority of new users. The accessibility issue here should be addressed but I'd say is a separate issue.

  11. self-assigned this
    on Jun 2, 2020
  12. modified the milestone: v1.4 on Jun 2, 2020
  13. 38 remaining items

  14. added this to the Later milestone on Oct 5, 2023
  15. bbolker commented on Mar 23, 2025

    @bbolker

    This has come up again here; still something people care about!

  16. kevinushey commented on Mar 23, 2025

    @kevinushey
    Collaborator

    FWIW that specific example (red text in the output of install.packages()) wouldn't be entirely solved even if we had special handling for messages, as the output for package download is printed via REprintf():

    https://github.com/wch/r-source/blob/d05acf513f567e330b5a56e8a933bcffba943694/src/modules/internet/libcurl.c#L790

    (and elsewhere in that file).

    It's obviously been a long time since this issue was first opened, but I would lean towards having stderr output unstyled by default, but perhaps only printed in red for error messages printed from uncaught errors?

  17. removed this from the Later milestone on Mar 23, 2025
  18. added this to the Backlog milestone on Mar 24, 2025
  19. self-assigned this
    on Mar 26, 2025
  20. kevinushey commented on Apr 2, 2025

    @kevinushey
    Collaborator

    We now have some support for this in the daily builds of RStudio. These are available for testing from https://dailies.rstudio.com.

    Rather than just adjust the highlight of messages, we now display them with a sort of "banner" display, with a similar treatment for warnings and errors. For example:

    Image

    This behavior can be adjusted; e.g. if you'd like this display for only specific condition types, or if you'd like to disable it altogether and return to the previous RStudio behavior.

    Image

    Feedback is definitely appreciated!

  21. DesiQuintans commented on Apr 3, 2025

    @DesiQuintans

    Ohhhh this is nice!

    The yellow Warning colour would be difficult to read with light themes.

    This might be strange feedback, but would you consider either a Warning colour that is sort of neutral in connotation (e.g. brown), or perhaps a colour that's middlingly positive, like a yellow-green? I have always explained Warnings as, "Your code still worked, but there's something you should know about it, and that detail might be important or it might be no big deal." The yellow colour still signals "Slow down, something's wrong" to me.

  22. kevinushey commented on Apr 3, 2025

    @kevinushey
    Collaborator

    The yellow Warning colour would be difficult to read with light themes.

    We use slightly different colours for the light theme (orange for warnings; red for errors).

    Image

    The colours could probably still be tweaked a bit to further increase the contrast, though -- maybe also bolding the red / orange text?

    This might be strange feedback, but would you consider either a colour that is sort of neutral in connotation (e.g. brown), or perhaps a colour that's middlingly positive, like a yellow-green? I have always explained Warnings as, "Your code still worked, but there's something you should know about it, and that detail might be important or it might be no big deal." The yellow colour still signals "Slow down, something's wrong" to me.

    That's great feedback -- I'll also raise this internally and see what others opinions are.

  23. ronblum commented on Apr 9, 2025

    @ronblum
    Contributor

    This is neat! But, "warning" seems to be misbehaving. This example uses the Crimon Editor theme:

    Image

    For warnings, the output starts with "Warning message" and then the warning itself is on the next line. "Warning" isn't highlighted.

  24. kevinushey commented on Apr 9, 2025

    @kevinushey
    Collaborator

    This is expected; the format of warning messages will differ based on whether options(warn = 0) is set or options(warn = 1) is set. I have options(warn = 1) set in my .Rprofile, but options(warn = 0) is the default.

    Image

    I guess we could highlight the title "Warning message" in the second case?

  25. ronblum commented on Apr 14, 2025

    @ronblum
    Contributor

    OK--I'll open a separate issue in which to discuss whether or not to change color when warn = 0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions