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

gh-128317: Highlight today in colour in calendar CLI output #128318

Merged
merged 6 commits into from
Jan 3, 2025

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 <[email protected]>
@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!


Return a single week in a string with no newline. If *w* is provided, it
specifies the width of the date columns, which are centered. Depends
on the first weekday as specified in the constructor or set by the
: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.

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