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 namedstyle argument to printstyled #41910

Closed
wants to merge 1 commit into from

Conversation

goerz
Copy link
Contributor

@goerz goerz commented Aug 17, 2021

Adds an (empty) global dict named_styles, and an argument namedstyle for the printstyled method that takes default color and text properties from the named_styles dict.

This is the first step in a proposal for addressing #41435

See #41435 (comment) for the underlying motivation

@goerz goerz marked this pull request as draft August 17, 2021 22:46
@@ -43,6 +43,8 @@ const disable_text_style = Dict{Symbol,String}(
:nothing => "",
)

const named_styles = Dict{String, NamedTuple{(:color, :properties), Tuple{Union{Symbol,Int}, Dict{Symbol, Bool}}}}()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unlike the implementation in #41435 (comment), I've made the values a namedtuple here. This should provide some "future-proofing", if with_output_color gains an argument for the background color, see #41435 (comment)

@goerz
Copy link
Contributor Author

goerz commented Aug 17, 2021

This will need to add tests, and possible documentation before it would be ready for merging (and, in fact, it might be good to take a serious stab at the second PR in my outline before considering it for a merge).

I just wanted to get a concrete proposal out, so that any discussion of implementation details can be done here instead of cluttering up the discussion for #41435.

I'm not strongly invested in this solution, so if @StefanKarpinski thinks this isn't a worthwhile direction to pursue, I don't mind closing this PR.

@goerz goerz force-pushed the 41435-namedstyles branch 5 times, most recently from 66118d7 to e4533a1 Compare August 18, 2021 17:13
This adds an (empty) global dict `named_styles` and an argument
`namedstyle` for the `printstyled` method that takes default color and
text properties from the `named_styles` dict.
@goerz goerz force-pushed the 41435-namedstyles branch from e4533a1 to eb32c1c Compare August 18, 2021 17:21
@goerz goerz closed this Mar 27, 2024
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.

1 participant