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

feat: enable color support in marimo notebooks #3651

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

banteg
Copy link

@banteg banteg commented Mar 4, 2025

Type of changes

  • Bug fix
  • New feature
  • Documentation / docstrings
  • Tests
  • Other

Checklist

  • I've run the latest black with default args on new code.
  • I've updated CHANGELOG.md and CONTRIBUTORS.md where appropriate.
  • I've added tests for new code.
  • I accept that @willmcgugan may be pedantic in the code review.

Description

I've added marimo notebook detection to the Rich console. The implementation includes:

  1. A new _is_marimo() function that:
  • Attempts to import the marimo module
  • Checks if marimo.running_in_notebook() is True
  • Handles both ImportError (if marimo isn't installed) and AttributeError (if the function doesn't exist)
  • Returns False if any errors occur
  1. Updated the _detect_color_system() method to:
  • Check for marimo notebooks using the new function
  • Set the color system to truecolor when running in a marimo notebook, just like with Jupyter

This implementation follows the same pattern as the existing Jupyter detection, ensuring consistent behavior across different notebook environments.

@banteg banteg force-pushed the feat/marimo-color branch from 1308d40 to 5c29651 Compare March 4, 2025 08:34
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