Skip to content

Revisions for the new --help #44800

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

Merged
merged 14 commits into from
Aug 5, 2021
Merged

Revisions for the new --help #44800

merged 14 commits into from
Aug 5, 2021

Conversation

orta
Copy link
Contributor

@orta orta commented Jun 29, 2021

Fixes #44798

@typescript-bot typescript-bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Jun 29, 2021
@DanielRosenwasser
Copy link
Member

What's the before/after look like?

@typescript-bot typescript-bot added For Milestone Bug PRs that fix a bug with a specific milestone and removed For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Jun 29, 2021
@orta
Copy link
Contributor Author

orta commented Jun 29, 2021

There is 3 ways blue can show:

  • Terminal supports 256+ colors. We don't use the terminal theme blue, but use an ANSI constant which is close to TS blue, which works on dark/light terminals:

    Screen Shot 2021-06-29 at 10 25 26 PM

    https://jonasjacek.github.io/colors/ - SteelBlue3 ANSI 68

  • Terminal supports 16 colors, this is windows console / powershell and probably some old school linux terminals
    Is it Windows? Then use "Bright Blue"
    Is it not Windows? Then use "Blue"

@DanielRosenwasser
Copy link
Member

@typescript-bot pack this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jun 29, 2021

Heya @DanielRosenwasser, I've started to run the tarball bundle task on this PR at b8015ef. You can monitor the build here.

@DanielRosenwasser
Copy link
Member

We don't use the terminal theme blue, but use an ANSI constant which is close to TS blue, which works on dark/light terminals:

For something with a pure white background (e.g. the default MacOS terminal theme) how does that look? On a white background, I'm getting a contrast ratio of 3.53 which is still fairly low.

Seems like if bright blue is this on CMD

image

and this is bright blue on PowerShell

image

that might work, though it's a bit off from brand colors.

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jun 29, 2021

Hey @DanielRosenwasser, I've packed this into an installable tgz. You can install it for testing by referencing it in your package.json like so:

{
    "devDependencies": {
        "typescript": "https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/_apis/build/builds/105942/artifacts?artifactName=tgz&fileId=F56CE154C3A2F891879AB5C6168315612816E538F151AB33B83481494114EA0002&fileName=/typescript-4.4.0-insiders.20210629.tgz"
    }
}

and then running npm install.


There is also a playground for this build and an npm module you can use via "typescript": "npm:@typescript-deploys/[email protected]".;

@DanielRosenwasser
Copy link
Member

DanielRosenwasser commented Jun 29, 2021

This seems to set the background color to blue.

image

and uh doesn't un-set it.

image

@orta
Copy link
Contributor Author

orta commented Jun 30, 2021

hahaha, well, I guess I need to get a windows VM up and running 🍡

@DanielRosenwasser
Copy link
Member

This is your big chance to tell us how you feel about Windows 11. 😅

@orta
Copy link
Contributor Author

orta commented Jun 30, 2021

Hah, well it does look like Windows 11 doesn't ruin the UI by trying to make it touch focused - I believe that was a mistake made back in Windows 8 which I wish Apple had also learned. That said, the overall design of Win 11 feels like it falls into the same tailwindification design style that's pretty much everywhere on the web too, it looks nice but it's all just a bit samey. For OS design though, I can see that that can be an advantage.

Anyway to this PR, I got up a few VMs and explored a bunch of options. In the end, I just dramatically simplified everything and took out almost all cases of being clever. We use 'bright blue' for blue everywhere except powershell/command prompt. This has a solid contrast

'strong blue' in default themes for terminal/vscode:
Screen Shot 2021-06-30 at 3 56 07 PM

'strong blue' fails in powershell though:

Screen Shot 2021-06-30 at 4 29 35 PM

While I'd love to be able to target just powershell, I couldn't see any ENV differences between the two, and so they both get 'strong cyan' instead:

Screen Shot 2021-06-30 at 4 31 15 PM

@DanielRosenwasser
Copy link
Member

What are your thoughts on just using a brighter white if 256 color isn't available?

@orta
Copy link
Contributor Author

orta commented Jun 30, 2021

I'm not offended, will switch it now

@DanielRosenwasser
Copy link
Member

@typescript-bot pack this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jul 1, 2021

Heya @DanielRosenwasser, I've started to run the tarball bundle task on this PR at 2c5a07d. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jul 1, 2021

Hey @DanielRosenwasser, I've packed this into an installable tgz. You can install it for testing by referencing it in your package.json like so:

{
    "devDependencies": {
        "typescript": "https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/_apis/build/builds/106056/artifacts?artifactName=tgz&fileId=2A9F5C67C72DBB2CDA4D7CDC7C10CF47309FA26B3E25D8DC044A7718057ED5E702&fileName=/typescript-4.4.0-insiders.20210701.tgz"
    }
}

and then running npm install.


There is also a playground for this build and an npm module you can use via "typescript": "npm:@typescript-deploys/[email protected]".;

@@ -90,32 +90,53 @@ namespace ts {
}

function createColors(sys: System) {
const showColors = defaultIsPretty(sys);
const showColors = defaultIsPretty(sys) || !!sys.getEnvironmentVariable("NO_COLOR");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks wrong. Shouldn't it be defaultIsPretty(sys) && !sys.getEnvironmentVariable("NO_COLOR")? If NO_COLOR exists, then we shouldn't print color... as is, if NO_COLOR is set, then tsc will write with colors even if it is not printing to a terminal.

(There's also the consideration that we should be checking for existence, not non-emptyness, but that's less important)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coming back to this - I think the environment check belongs in the defaultIsPretty function... but maybe I don't understand that yet.

Copy link
Contributor Author

@orta orta Jul 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, yeah I was avoiding making more drastic changes by adding NO_COLOR support everywhere (somewhat making this bug-fix a feature) by moving it into defaultIsPretty - running the tests now too see how that changes the test suite.

(edit: looks like no changes)

@orta
Copy link
Contributor Author

orta commented Jul 19, 2021

There are three different color rendering setup now: plain text, plain text + bold, color:

Screen Shot 2021-07-19 at 7 49 10 AM

@orta
Copy link
Contributor Author

orta commented Jul 19, 2021

I've switched to have NO_COLORin defaultIsPretty and added a test to verify the plain-text-ness of the output

@DanielRosenwasser
Copy link
Member

@typescript-bot pack this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Aug 3, 2021

Heya @DanielRosenwasser, I've started to run the tarball bundle task on this PR at c350c39. You can monitor the build here.

Copy link
Member

@DanielRosenwasser DanielRosenwasser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to try this out first - I won't block on that though.

@@ -14,5 +14,14 @@ namespace ts {
fs: () => loadProjectFromFiles({}),
commandLineArgs: [],
});

verifyTsc({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like these tests generate a .js file - would be awesome if we could change that though.

@typescript-bot
Copy link
Collaborator

typescript-bot commented Aug 3, 2021

Hey @DanielRosenwasser, I've packed this into an installable tgz. You can install it for testing by referencing it in your package.json like so:

{
    "devDependencies": {
        "typescript": "https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/_apis/build/builds/107935/artifacts?artifactName=tgz&fileId=35C0FBAAA434C08A4B9FECAB82DFF85F7EF760F2A9D597743E0081C08C1FEF1B02&fileName=/typescript-4.4.0-insiders.20210803.tgz"
    }
}

and then running npm install.


There is also a playground for this build and an npm module you can use via "typescript": "npm:@typescript-deploys/[email protected]".;

@orta
Copy link
Contributor Author

orta commented Aug 5, 2021

Requests merged, I'm going to get this in so that it doesn't get overlooked before the RC

@orta orta merged commit 1f85123 into microsoft:main Aug 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Milestone Bug PRs that fix a bug with a specific milestone
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

tsc --help is unreadable or hard to read in Windows default themes
4 participants