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

Align JSON and CodeEditor default theme with overall theme #7406

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

MarcSkovMadsen
Copy link
Collaborator

Closing #7394.

Looks like below

Default

image

Dark

image

Script

You can use the below to select the appropriate dark theme for the CodeEditor.

import panel as pn

pn.extension("codeeditor", sizing_mode="stretch_width")

ace_dark_themes = [
    "ambiance",
    "chaos",
    "clouds_midnight",
    "cobalt",
    "dracula",
    "gob",
    "gruvbox",
    "idle_fingers",
    "kr_theme",
    "merbivore",
    "merbivore_soft",
    "mono_industrial",
    "monokai",
    "pastel_on_dark",
    "solarized_dark",
    "terminal",
    "tomorrow_night",
    "tomorrow_night_blue",
    "tomorrow_night_bright",
    "tomorrow_night_eighties",
    "twilight",
    "vibrant_ink"
]

code="""
import panel as pn

pn.extension("codeeditor")

code_editor = pn.widgets.CodeEditor(value="abcd")

pn.template.FastListTemplate(
    sidebar=[code_editor.param.theme],
    main=[code_editor, pn.pane.JSON({"a": 1, "b": 2})]
).servable()
"""

pn.template.FastListTemplate(
    main=[pn.widgets.CodeEditor(value=code, language="python"), pn.pane.JSON({"a": 1, "b": 2}), *[pn.Column(theme, pn.widgets.CodeEditor(value=code, language="python", theme=theme)) for theme in ace_dark_themes]],
).servable()

@MarcSkovMadsen MarcSkovMadsen linked an issue Oct 16, 2024 that may be closed by this pull request
@MarcSkovMadsen MarcSkovMadsen added this to the v1.5.3 milestone Oct 16, 2024
Copy link

codecov bot commented Oct 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.23%. Comparing base (ced01e4) to head (feeb4fc).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7406   +/-   ##
=======================================
  Coverage   82.23%   82.23%           
=======================================
  Files         337      337           
  Lines       50557    50601   +44     
=======================================
+ Hits        41576    41614   +38     
- Misses       8981     8987    +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@MarcSkovMadsen
Copy link
Collaborator Author

When you review please consider it as a concept for theming that can be extended to matplotlib, Plotly and other components.

panel/pane/markup.py Outdated Show resolved Hide resolved
@MarcSkovMadsen
Copy link
Collaborator Author

MarcSkovMadsen commented Oct 16, 2024

Its probably also worth considering whether this should be handled in the frontend to enable saved apps to be able to handle themes. As a minimum the API should be something we could convert to a frontend implementation one day.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consistent theme for JSON pane and Code Editor
2 participants