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

Initial support for dark mode terminals #933

Merged
merged 3 commits into from
May 2, 2024
Merged

Initial support for dark mode terminals #933

merged 3 commits into from
May 2, 2024

Conversation

Nuru
Copy link
Sponsor Contributor

@Nuru Nuru commented May 1, 2024

notes

Dark mode

This release brings preliminary support for "dark mode" terminals, and a simplified option for a Terraform workspace prompt. If you find problems, please report them, but we expect the situation will at least be no worse than before.

Mainly, with respect to dark mode terminals, after setting a text color, we do not "revert" by setting the text to black, we now revert by setting foreground and background to terminal defaults.

Similarly, after setting text to bold, we no longer reset all graphics settings, we just unset bold. If this causes a problem in your terminal, you can revert the behavior by setting the environment variable TERM_BOLD_OFF=$(tput sgr0) inside Geodesic.

Terraform workspace in prompt

Geodesic has a legacy option for displaying the current Terraform workspace when in a directory with *.tf files. The prompts used to instruct you what to do if no workspace was selected, assuming you were using the old Cloud Posse tooling based on make and direnv. Those instructions have been removed, and you now have the option of just having the Terraform workspace displayed in the prompt.

Because all the prompt now does is indicate the current Terraform workspace, the environment variable GEODESIC_TERRAFORM_WORKSPACE_PROMPT_ENABLED is no longer used (assumed to be true). The Terraform information display in the prompt remains controlled by the GEODESIC_TF_PROMPT_ENABLED environment variable, which defaults to false.

what

  • Initial support for "dark mode" terminals
  • More generic Terraform workspace prompt, just shows active workspace
  • Update scripts to keep them from polluting the environment with leftover variables

why

  • In many cases, after setting a text color, Geodesic was "resetting" the text color by setting it to black. This fails in dark mode terminals, where the background is black and the text color should be changed to white instead.
  • As a bonus, text that was previously yellow, which can be hard to read on light mode terminals, will now be rendered as magenta in light mode. Similarly, blue text (which Geodesic never used) will be rendered as cyan in dark mode, for improved visibility.
  • Terraform's current workspace affects what Terraform does, but is not otherwise visible.
  • Good hygiene, preemptively avoid conflicts.

@Nuru Nuru requested a review from a team as a code owner May 1, 2024 02:34
@Nuru Nuru requested review from osterman and aknysh May 1, 2024 02:34
@Nuru Nuru added the minor New features that do not break anything label May 1, 2024
@Nuru Nuru merged commit 75c48f6 into master May 2, 2024
6 checks passed
@Nuru Nuru deleted the dark-mode branch May 2, 2024 00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor New features that do not break anything
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant