Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Color output of sf org list is very difficult to read in a white terminal window #2647

Closed
jclark-dot-org opened this issue Jan 15, 2024 · 3 comments
Labels
investigating We're actively investigating this issue validated Version information for this issue has been validated

Comments

@jclark-dot-org
Copy link

jclark-dot-org commented Jan 15, 2024

Summary

In CLI V2 (I have @salesforce/cli/2.23.20), sf org list produces colored text output, including:

  • cyan text for Production orgs (labeled 'DevHub' even if never used as such)
  • magenta text for many sandbox orgs, which have no value in the output's Type column
  • yellow text for sandbox orgs identified as such in the output's Type column

While this probably looks great for "dark mode" users, and others with a dark background in their terminal, it is very difficult to read for a user with a white (or other light color) background in their terminal window. I can only guess what accessibility issues it might raise for low vision users.

Steps To Reproduce

No Repo needed, just a system with a variety of authenticate orgs to list.

  1. Open a terminal window, and set the display to black text on a white background. For example, this is the default in Mac OS terminal if you are not using Dark Mode.
  2. Run sf org list

Expected result

Results should be legible.

Actual result

Results are very difficult to read - especially yellow-on-white sandboxes. Please note that I cannot post a screenshot here because I do not want to publicly post user names or orgids, or even org aliases (which identify clients). I am willing to share screenshots directly with SF employees via email.

System Information

Mac OS 14.1.2

> $ sf version --verbose --json
(node:16096) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
{
  "architecture": "darwin-arm64",
  "cliVersion": "@salesforce/cli/2.23.20",
  "nodeVersion": "node-v21.4.0",
  "osVersion": "Darwin 23.1.0",
  "rootPath": "/Users/jclark/.nvm/versions/node/v21.4.0/lib/node_modules/@salesforce/cli",
  "shell": "zsh",
  "pluginVersions": [
    "@oclif/plugin-autocomplete 3.0.4 (core)",
    "@oclif/plugin-commands 3.1.0 (core)",
    "@oclif/plugin-help 6.0.9 (core)",
    "@oclif/plugin-not-found 3.0.7 (core)",
    "@oclif/plugin-plugins 4.1.14 (core)",
    "@oclif/plugin-search 1.0.10 (core)",
    "@oclif/plugin-update 4.1.7 (core)",
    "@oclif/plugin-version 2.0.11 (core)",
    "@oclif/plugin-warn-if-update-available 3.0.8 (core)",
    "@oclif/plugin-which 3.0.14 (core)",
    "@salesforce/cli 2.23.20 (core)",
    "apex 3.0.14 (core)",
    "auth 3.1.0 (core)",
    "data 3.0.13 (core)",
    "deploy-retrieve 2.2.12 (core)",
    "info 3.0.13 (core)",
    "limits 3.1.0 (core)",
    "marketplace 1.0.15 (core)",
    "org 3.2.0 (core)",
    "packaging 2.0.1 (core)",
    "schema 3.1.0 (core)",
    "settings 2.0.14 (core)",
    "sobject 1.0.7 (core)",
    "source 3.0.10 (core)",
    "telemetry 3.1.8 (core)",
    "templates 56.0.8 (core)",
    "trust 3.2.5 (core)",
    "user 3.2.0 (core)"
  ]
}
                    

sf doctor output clean.

(Indidentally, the output of sf version --verbose --json is also colored, and in particular the punctuation (e.g. braces, brackets) is a very light grey that is almost invisible on a white background.)

My normal terminal is the Mac OS terminal app, running zsh (with OhMyZSH) in a tmux session, however, I have reproduced this same behavior in sh (no zsh, no tmux).

Additional information

@jclark-dot-org jclark-dot-org added the investigating We're actively investigating this issue label Jan 15, 2024
Copy link

Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support.

@github-actions github-actions bot added the validated Version information for this issue has been validated label Jan 15, 2024
@shetzel
Copy link
Contributor

shetzel commented Jan 16, 2024

Short answer to this is to turn off all colors by setting the environment variable: FORCE_COLOR=0. The CLI uses the chalk library for terminal colors. Since this solves the problem I'll close the issue, but provide some additional info.

We have plans to handle CLI themes but it's not quite in a user friendly state yet.

For the org categorization things:

"cyan text for Production orgs (labeled 'DevHub' even if never used as such)" --> We try to identify and label devhubs as best we can. The command first checks the auth file for isDevHub and if not there will query the org to see if it supports ScratchOrgInfo. So if the org could be used as a devhub we mark it as such.

"magenta text for many sandbox orgs, which have no value in the output's Type column" --> We try to detect sandbox orgs and label them. The detection code was recently improved (within the past few months) so it could be that those sandboxes have been around for a while. If you re-auth to those sandboxes it will likely be marked as such, but I believe the CLI needs the associated production org auth info for this. If the CLI doesn't think it's a prod org, or sandbox, or scratch org, it doesn't have a type assigned.

@shetzel shetzel closed this as completed Jan 16, 2024
@cristiand391
Copy link
Member

cristiand391 commented Jan 17, 2024

this isn't exactly a fix or replacement for org list but I have an alias to quickly list auth'd orgs in a nice table format:

requires:

  1. jq: https://github.com/jqlang/jq
  2. gum: https://github.com/charmbracelet/gum

unlike sf org list, sf org list auth doesn't query orgs so it's a bit faster.

➜  sf org list auth --json | jq -r '["Username", "Alias"], (.result | .[] | [.username,.
alias]) | @csv' | gum table -p
╭─────────────────────────────────────────┬───────────────────╮
│ Username                                │ Alias             │
├─────────────────────────────────────────┼───────────────────┤
│ XXXXXXXXXXXXXXXXXXX                     │ na40              │
│ XXXXXXXXXXXXXXXXXXX                     │ trailhead-pg      │
│ XXXXXXXXXXXXXXXXXXX                     │ cd                │
│ XXXXXXXXXXXXXXXXXXX                     │ playground        │
│ XXXXXXXXXXXXXXXXXXX                     │ deved             │
│ XXXXXXXXXXXXXXXXXXX                     │                   │
╰─────────────────────────────────────────┴───────────────────╯

works fine on any dark/light theme (and can customize table colors with gum).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
investigating We're actively investigating this issue validated Version information for this issue has been validated
Projects
None yet
Development

No branches or pull requests

3 participants