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

repl: No color_depth for show_result and OutputPrinter #596

Open
vallsv opened this issue Oct 7, 2024 · 0 comments
Open

repl: No color_depth for show_result and OutputPrinter #596

vallsv opened this issue Oct 7, 2024 · 0 comments

Comments

@vallsv
Copy link
Contributor

vallsv commented Oct 7, 2024

Hi,

I use another version of ptpython and have noticed that the result of PythonRepl does not take care of the color_depth.

    def print_formatted_text(
        self, formatted_text: StyleAndTextTuples, end: str = "\n"
    ) -> None:
        print_formatted_text(
            FormattedText(formatted_text),
            style=self._current_style,
            style_transformation=self.style_transformation,
            include_default_pygments_style=False,
            output=self.app.output,
            end=end,
        )

Looking at your main code code, now not it use a OutputPrinter but the result is the same.

Is there a reason not to use color_depth for printing the result (while the min/max intensity are propagated through self.style_transformation)?

It's particularly weird when the color_depth = 1bit.

The fix was easy, but have to be done in a different way in your main branch.

    def print_formatted_text(
        self, formatted_text: StyleAndTextTuples, end: str = "\n"
    ) -> None:
        print_formatted_text(
            FormattedText(formatted_text),
            style=self._current_style,
            style_transformation=self.style_transformation,
+           color_depth=self.color_depth,
            include_default_pygments_style=False,
            output=self.app.output,
            end=end,
        )

What do you think?

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

No branches or pull requests

1 participant