context

Backward-compatible shim. The implementation now lives in cnotebook.core.context.

CNotebookContext Class

The CNotebookContext class manages global rendering settings for molecule visualization.

Usage

import cnotebook

# Get the global context
ctx = cnotebook.cnotebook_context.get()

# Modify settings
ctx.width = 300
ctx.height = 300
ctx.image_format = "svg"

# Reset to defaults
ctx.reset()

Configuration Options

Image Dimensions

  • width: Default image width in pixels (default: 250)

  • height: Default image height in pixels (default: 250)

  • max_width: Maximum allowed width (default: 1200)

  • max_height: Maximum allowed height (default: 800)

Output Format

  • image_format: Output format, either “png” or “svg” (default: “png”)

Scaling

  • scale: Scaling factor for depictions (default: 1.0)