KEMBAR78
gh-128317: Highlight today in colour in calendar CLI output by hugovk · Pull Request #128318 · python/cpython · GitHub
Skip to content

Conversation

@hugovk
Copy link
Member

@hugovk hugovk commented Dec 28, 2024

Here's the macOS cal command:

image image

Here's the calendar CLI output in 3.13:

image image

And with this PR:

image image

Especially useful for Twixtmas when you're not sure what day it is!

The usual PYTHON_COLORS, FORCE_COLOR and NO_COLOR env vars can be used to override terminal colour detection.


📚 Documentation preview 📚: https://cpython-previews--128318.org.readthedocs.build/

@hugovk hugovk added the type-feature A feature request or enhancement label Dec 28, 2024
Copy link
Member

@ZeroIntensity ZeroIntensity left a comment

Choose a reason for hiding this comment

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

Nice, here's what it looks like on KDE :)

image

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
@hugovk hugovk merged commit f21af18 into python:main Jan 3, 2025
38 checks passed
@hugovk hugovk deleted the 3.14-calendar-colour branch January 3, 2025 12:56
@hugovk
Copy link
Member Author

hugovk commented Jan 3, 2025

Thanks all for the reviews!

:meth:`setfirstweekday` method.

.. versionchanged:: next
If *highlight_day* is given, this date is highlighted in color.
Copy link
Member

Choose a reason for hiding this comment

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

Should this say “using terminal escape sequences”?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm, I think it's more useful to describe the end result rather than the "how".

Copy link
Member

Choose a reason for hiding this comment

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

That was my intention: mention that you need to print the result to a terminal to see the highlight. If you don't, you'll see some garbage bytes.

WolframAlph pushed a commit to WolframAlph/cpython that referenced this pull request Jan 4, 2025
srinivasreddy pushed a commit to srinivasreddy/cpython that referenced this pull request Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type-feature A feature request or enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants