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

Add support for short hex color codes like #CCC (#2639) #2658

Merged

Conversation

kojoru
Copy link
Contributor

@kojoru kojoru commented Sep 4, 2019

Summary of the Pull Request

This adds a few lines to support shorthand color hex codes like #ABC. They are treated as equivalent of #AABBCC

References

N/A

PR Checklist

Detailed Description of the Pull Request / Additional comments

The PR is only a few lines of code so should be self-explanatory.

Validation Steps Performed

I've changed src/cascadia/ut_app/JsonTests.cpp thanks to the fact that Cascadia actually has a white color that can be expressed this way. The new test passes on my machine.

I thought that change might be a better idea than adding a new test to https://github.com/microsoft/terminal/blob/master/src/types/ut_types/UtilsTests.cpp as discussed originally, if only for the reason of simplicity. I'll be happy to write an explicit test if that seems like a better idea to maintainers.

Copy link
Member

@miniksa miniksa left a comment

Choose a reason for hiding this comment

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

Good enough to me. I'm fine with the test in this place.


if (str.size() == 4)
{
rStr = std::string(2, str[1]);
Copy link
Contributor

Choose a reason for hiding this comment

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

this is clever! Making two copies of the character before we parse it...

@DHowett-MSFT DHowett-MSFT merged commit 51f5353 into microsoft:master Sep 4, 2019
@ghost
Copy link

ghost commented Sep 24, 2019

🎉Windows Terminal Preview v0.5.2661.0 has been released which incorporates this pull request.:tada:

Handy links:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for short hex color codes (like #CCC)
3 participants