### Install Dependencies and Run Basic Example Source: https://github.com/legout/panel-siemens-ix/blob/main/examples/README.md Installs project dependencies and serves a minimal Panel application. Use this for a quick start. ```bash # Install dependencies uv sync --group dev # Run a basic example cd examples/basic panel serve minimal_app.py --dev --show ``` -------------------------------- ### Apply Siemens iX Configuration and Create App Source: https://github.com/legout/panel-siemens-ix/blob/main/README.md Quick start example demonstrating how to apply the complete Siemens iX configuration using the `configure()` function, enable Panel extensions, and create a basic app with Material UI components and theme toggling. ```python import panel as pn import panel_material_ui as pmui from panel_siemens_ix import configure # Apply complete Siemens iX configuration configure() # Enable Panel extensions pn.extension() # Create your app with Material UI components app = pmui.Page( title="My Siemens iX App", main=[ pmui.Button(name="Primary Action", button_type="primary"), pmui.TextInput(name="Input Field", placeholder="Enter text..."), pmui.Alert(object="Welcome to Siemens iX!", alert_type="success") ], theme_toggle=True # Enable light/dark theme switching ) app.servable() ``` -------------------------------- ### Run All Panel Examples Source: https://github.com/legout/panel-siemens-ix/blob/main/examples/EXAMPLES_SUMMARY.md Execute all Python examples within the examples directory using the Panel development server. ```bash # From project root panel serve examples/**/*.py --dev --show ``` -------------------------------- ### Run Example Application Source: https://github.com/legout/panel-siemens-ix/blob/main/README.md Shows how to run example applications from the `examples/` directory using Python or Panel serve. Useful for testing and exploring features. ```bash # Run any example directly python examples/basic/showcase_compact.py # Or serve with Panel panel serve examples/basic/showcase_compact.py --dev --show # Other examples python examples/basic/component_showcase.py # View all examples ls examples/ ``` -------------------------------- ### Run All Panel Examples Simultaneously Source: https://github.com/legout/panel-siemens-ix/blob/main/examples/README.md Serves all Python files within the examples directory using the development server. This is useful for testing or exploring multiple examples at once. ```bash # From the root directory panel serve examples/**/*.py --dev --show ``` -------------------------------- ### Install panel-siemens-ix Source: https://context7.com/legout/panel-siemens-ix/llms.txt Install the library using pip or uv. ```bash pip install panel-siemens-ix # or uv pip install panel-siemens-ix ``` -------------------------------- ### Install panel-siemens-ix with pip Source: https://github.com/legout/panel-siemens-ix/blob/main/README.md Install the library using pip. This is the standard method for Python package installation. ```bash pip install panel-siemens-ix ``` -------------------------------- ### Install panel-siemens-ix with uv Source: https://github.com/legout/panel-siemens-ix/blob/main/README.md Install the library using uv, a fast Python package installer. This is an alternative to pip. ```bash uv pip install panel-siemens-ix ``` -------------------------------- ### Run Individual Panel App Source: https://github.com/legout/panel-siemens-ix/blob/main/examples/EXAMPLES_SUMMARY.md Navigate to the example directory and run a Panel application using the development server or directly with Python. ```bash # Navigate to examples directory cd examples/basic # Run with Panel development server (recommended) panel serve minimal_app.py --dev --show # Or run directly with Python python minimal_app.py ``` -------------------------------- ### Run Individual Panel Examples Source: https://github.com/legout/panel-siemens-ix/blob/main/examples/README.md Navigates to an example directory and runs a Panel application using the development server for hot reloading. Alternatively, it can be run directly with Python. ```bash # Navigate to any example directory cd examples/basic # Run with development server (hot reload) panel serve minimal_app.py --dev --show # Or run directly with Python python minimal_app.py ``` -------------------------------- ### Create Basic Siemens iX Application Source: https://github.com/legout/panel-siemens-ix/blob/main/README.md Example of creating a simple Panel application with Material UI components styled using the Siemens iX theme. Ensure `configure()` is called before `pn.extension()`. ```python import panel as pn import panel_material_ui as pmui from panel_siemens_ix import configure # Apply Siemens iX configuration configure() pn.extension() # Simple app with Material UI components def create_basic_app(): return pmui.Container( pmui.Typography("Welcome to Siemens iX", variant="h4"), pmui.Button( name="Get Started", button_type="primary", icon="rocket_launch" ), pmui.TextInput( name="Your Name", placeholder="Enter your name..." ) ) # Serve the app create_basic_app().servable() ``` -------------------------------- ### Apply Full Siemens iX Configuration Source: https://github.com/legout/panel-siemens-ix/blob/main/README.md Applies the complete Siemens iX setup, including logos, favicon, theme, and default component styles. This is the recommended way to integrate the theme. ```python from panel_siemens_ix import configure # Apply complete Siemens iX setup configure() ``` -------------------------------- ### Create Parameter-Driven Siemens iX Application Source: https://github.com/legout/panel-siemens-ix/blob/main/README.md Recommended approach for building Panel applications using `param`. This example demonstrates a reactive application with input parameters and a status display, styled with the Siemens iX theme. Ensure `configure()` is called before `pn.extension()`. ```python import panel as pn import panel_material_ui as pmui import param from panel_siemens_ix import configure configure() pn.extension() class MyApp(pn.viewable.Viewer): """Parameter-driven app following Panel best practices.""" # App parameters text_input = param.String(default="Hello Siemens iX!") number_value = param.Number(default=42, bounds=(0, 100)) def __init__(self, **params): super().__init__(**params) self._create_layout() def _create_layout(self): """Create the app layout.""" self._layout = pmui.Container( pmui.Typography("Parameter-Driven App", variant="h4"), pmui.TextInput.from_param( self.param.text_input, name="Text Input" ), pmui.FloatInput.from_param( self.param.number_value, name="Number Input" ), pmui.Typography( object=self.status_display, variant="body1" ) ) @param.depends("text_input", "number_value") def status_display(self): """Reactive status display.""" return f"Current values: '{self.text_input}' and {self.number_value}" def __panel__(self): """Return the layout for Panel.""" return self._layout # Create and serve the app MyApp().servable() ``` -------------------------------- ### Apply Siemens iX Branding Globally Source: https://context7.com/legout/panel-siemens-ix/llms.txt Use the `configure()` function for a one-call setup of Siemens iX themes, logos, and favicons for all `pmui.Page` instances. Call this before creating `pmui.Page` objects. ```python import panel as pn import panel_material_ui as pmui from panel_siemens_ix import configure # Apply complete Siemens iX branding globally (logos, favicon, themes, sx defaults) configure() # with Siemens logos # configure(with_logo=False) # suppress logos for white-label use pn.extension(notifications=True) class MyApp(pn.viewable.Viewer): import param counter = param.Integer(default=0) def __init__(self, **params): super().__init__(**params) with pn.config.set(sizing_mode="stretch_width"): self._btn = pmui.Button( name="Increment", button_type="primary", icon="add", on_click=lambda e: setattr(self, "counter", self.counter + 1) ) self._label = pmui.Typography(object=self._count_text, variant="h5") self._layout = pmui.Container(self._label, self._btn) @pn.depends("counter") # reactive: re-renders when counter changes def _count_text(self): return f"Count: {self.counter}" def __panel__(self): return self._layout @classmethod def create_app(cls): # theme_config, logo, favicon all pre-configured by configure() return pmui.Page( title="My iX App", main=[cls()], theme_toggle=True # built-in light/dark toggle ) if __name__ == "__main__": MyApp.create_app().show(port=5007, autoreload=True, open=True) elif pn.state.served: MyApp.create_app().servable() ``` -------------------------------- ### Configure and Serve Siemens iX Themed App Source: https://github.com/legout/panel-siemens-ix/blob/main/examples/README.md Use this snippet to enable the Material UI extension and apply the complete Siemens iX branding. It demonstrates creating a basic page with a title and includes examples of a primary button and a text field, all styled according to the Siemens iX theme. The page is then made servable. ```python import panel as pn import panel_material_ui as pmui from panel_siemens_ix import configure # Enable Material UI extension pn.extension() # Apply complete Siemens iX branding configure() # Create a Page with Siemens iX theme page = pmui.Page( title="My Siemens iX App", main=[ pmui.Button(name="Primary Button", button_type="primary"), pmui.TextField(name="Input", placeholder="Enter text..."), ] ) page.servable() ``` -------------------------------- ### Get Categorical Color Palettes for Visualization Source: https://context7.com/legout/panel-siemens-ix/llms.txt Generate lists of hex color strings optimized for categorical data visualization. Supports semantic colors for small palettes, samples from the chart palette for larger counts, and includes opacity variants. ```python from panel_siemens_ix.colors import get_categorical_palette import panel_material_ui as pmui # Small semantic palette (≤5 colors) palette_3 = get_categorical_palette(dark_theme=False, n_colors=3) # ['#007993', '#01893a', '#e9c32a'] — primary, success, warning # Standard 8-color categorical palette for light theme palette_8 = get_categorical_palette(dark_theme=False, n_colors=8) # 8-color categorical palette for dark theme palette_8_dark = get_categorical_palette(dark_theme=True, n_colors=8) # 40%-opacity variants for area/stacked charts palette_opaque = get_categorical_palette(dark_theme=True, n_colors=5, opacity=True) # Returns hex codes ending in '66' suffix (40% alpha) # Primary-color monochromatic palette primary_palette = get_categorical_palette(primary=True, n_colors=6) # Use with hvPlot import pandas as pd, numpy as np df = pd.DataFrame({"date": pd.date_range("2024-01-01", periods=50), "A": np.random.randn(50).cumsum(), "B": np.random.randn(50).cumsum()}) import hvplot.pandas chart = df.hvplot.line(y=["A","B"], cmap=palette_8[:2], line_width=2) # Use with Plotly Express import plotly.express as px fig = px.scatter(df.melt("date"), x="date", y="value", color="variable", color_discrete_sequence=palette_8) ``` -------------------------------- ### Get Siemens iX Color Palettes Source: https://context7.com/legout/panel-siemens-ix/llms.txt Retrieve the full Siemens iX color palette for light or dark modes. Access semantic colors, background, text hierarchy, and chart palettes. Colors are provided as dictionaries of hex/rgba values. ```python from panel_siemens_ix.colors import get_colors light = get_colors("light") dark = get_colors("dark") # Semantic colors print(light.primary["main"]) # '#007993' print(light.primary["hover"]) # '#196269' print(light.primary["active"]) # '#16565c' print(light.primary["contrast"]) # '#ffffff' print(dark.primary["main"]) # '#00cccc' print(dark.success["main"]) # '#01d65a' print(dark.error["main"]) # '#ff2640' print(dark.warning["main"]) # '#ffd732' # Background / surface print(light.background["default"]) # '#ffffff' print(light.background["paper"]) # '#f3f3f0' print(dark.background["default"]) # '#000028' print(dark.background["surface"]) # '#37374d' # Text hierarchy print(light.text["primary"]) # '#000028' print(light.text["secondary"]) # '#00002899' print(light.text["disabled"]) # '#0000284d' # Chart palette (17 colors + 40%-opacity variants) print(light.chart["1"]) # '#007993' print(light.chart["1-40"]) # '#00799366' print(dark.chart["1"]) # '#00ffb9' # Export as plain dict import json print(json.dumps(light.to_dict()["primary"], indent=2)) # { # "main": "#007993", # "hover": "#196269", # "active": "#16565c", # "contrast": "#ffffff", # "disabled": "#0079934d" # } ``` -------------------------------- ### EquipmentForm Viewer with Parameterized UI Source: https://context7.com/legout/panel-siemens-ix/llms.txt This snippet demonstrates the `pn.viewable.Viewer` pattern for creating a form. It uses `param` attributes for reactive state and `pmui.Widget.from_param()` for two-way data binding. UI updates are managed via `@param.depends` methods. ```python import panel as pn import panel_material_ui as pmui import param from panel_siemens_ix import configure configure() pn.extension(notifications=True) class EquipmentForm(pn.viewable.Viewer): name = param.String(default="") voltage = param.Number(default=400.0, bounds=(0, 1000)) critical = param.Boolean(default=False) is_valid = param.Boolean(default=False) def __init__(self, **params): super().__init__(**params) with pn.config.set(sizing_mode="stretch_width"): self._name_input = pmui.TextInput.from_param( self.param.name, name="Equipment Name *", placeholder="Enter name..." ) self._volt_input = pmui.FloatInput.from_param( self.param.voltage, name="Voltage (V)" ) self._critical_sw = pmui.Switch.from_param( self.param.critical, name="Critical Equipment" ) self._submit = pmui.Button( name="Register", button_type="primary", icon="save", on_click=self._on_submit, disabled=pn.bind(lambda v: not v, self.param.is_valid) ) self._error_banner = pmui.Alert( object=self._validation_text, alert_type="error", visible=pn.bind(lambda v: not v, self.param.is_valid) ) self._layout = pmui.Container( pmui.Typography("Equipment Registration", variant="h4"), pmui.Card( self._name_input, self._volt_input, self._critical_sw, styles={"padding": "20px"} ), self._error_banner, self._submit, width_option="md" ) @param.depends("name", "voltage", watch=True) def _revalidate(self): self.is_valid = bool(self.name.strip()) and self.voltage > 0 @param.depends("name", "voltage") def _validation_text(self): errors = [] if not self.name.strip(): errors.append("Name is required") if self.voltage <= 0: errors.append("Voltage must be > 0") return "\n".join(f"• {e}" for e in errors) if errors else "" def _on_submit(self, event): if pn.state.notifications: pn.state.notifications.success( f"Registered '{self.name}' at {self.voltage}V", duration=3000 ) def __panel__(self): return self._layout @classmethod def create_app(cls): return pmui.Page( title="Equipment Form – Siemens iX", main=[cls()], theme_toggle=True ) if __name__ == "__main__": EquipmentForm.create_app().show(port=5007, autoreload=True, open=True) elif pn.state.served: EquipmentForm.create_app().servable() ``` -------------------------------- ### Import Custom Siemens iX Themes Source: https://github.com/legout/panel-siemens-ix/blob/main/README.md Demonstrates how to import the light and dark theme objects directly from the `panel_siemens_ix.theme` module for advanced customization scenarios. ```python import panel as pn import panel_material_ui as pmui from panel_siemens_ix.theme import siemens_ix_light_theme, siemens_ix_dark_theme pn.extension() ``` -------------------------------- ### Manually Configure Themes for a Page Source: https://github.com/legout/panel-siemens-ix/blob/main/README.md Shows how to manually apply Siemens iX light and dark themes to a specific Panel page. Useful for granular control over theme application. ```python import panel_material_ui as pmui from panel_siemens_ix.theme import siemens_ix_light_theme, siemens_ix_dark_theme # Apply themes manually to a Page app = pmui.Page( theme_config={ "light": siemens_ix_light_theme, "dark": siemens_ix_dark_theme }, theme_toggle=True ) ``` -------------------------------- ### Create Page with Custom Siemens iX Theme Source: https://github.com/legout/panel-siemens-ix/blob/main/README.md Demonstrates how to create a Panel page with custom light and dark themes using Siemens iX styles. Enables theme toggling for user selection. ```python app = pmui.Page( title="Custom Theme App", main=[ pmui.Typography("Custom Siemens iX Theme", variant="h4"), pmui.Button(name="Primary Button", button_type="primary"), pmui.Alert(object="Themed with Siemens iX colors!", alert_type="info") ], # Configure both themes theme_config={ "light": siemens_ix_light_theme, "dark": siemens_ix_dark_theme }, theme_toggle=True ) app.servable() ``` -------------------------------- ### Create Industrial Dashboard with Cached Data Source: https://context7.com/legout/panel-siemens-ix/llms.txt This snippet demonstrates how to create a data-intensive dashboard using `@pn.cache` for efficient data loading and `@param.depends` for reactive KPI updates. It separates data logic from UI, supports time-to-live (TTL) based expiry, and avoids redundant computations. ```python import panel as pn import panel_material_ui as pmui import param, pandas as pd, numpy as np, datetime from panel_siemens_ix import configure configure() pn.extension(notifications=True) @pn.cache(max_items=3, ttl=300) def load_metrics(days: int) -> pd.DataFrame: np.random.seed(42) dates = pd.date_range(end=datetime.date.today(), periods=days, freq="D") return pd.DataFrame({ "date": dates, "efficiency": np.random.normal(85, 5, days).clip(70, 95), "energy": np.random.normal(500, 50, days), }) class Dashboard(pn.viewable.Viewer): days = param.Integer(default=30, bounds=(7, 90)) def __init__(self, **params): super().__init__(**params) with pn.config.set(sizing_mode="stretch_width"): self._kpi_row = pmui.Row( pmui.Card(pmui.Typography(object=self._eff_kpi, variant="h6"), styles={"padding":"15px","margin":"5px"}), pmui.Card(pmui.Typography(object=self._nrg_kpi, variant="h6"), styles={"padding":"15px","margin":"5px"}), styles={"flexWrap": "wrap"} ) self._ctrl = pmui.IntSlider.from_param(self.param.days, name="Days", styles={"margin":"10px 0"}) self._layout = pmui.Container( pmui.Typography("Industrial Dashboard", variant="h4"), self._kpi_row, width_option="xl" ) @param.depends("days") def _eff_kpi(self): df = load_metrics(self.days) avg = df["efficiency"].mean() return f"Efficiency: {avg:.1f}%" @param.depends("days") def _nrg_kpi(self): df = load_metrics(self.days) total = df["energy"].sum() return f"Energy: {total:,.0f} kWh" def __panel__(self): return self._layout @classmethod def create_app(cls): inst = cls() return pmui.Page( title="Dashboard – Siemens iX", main=[inst], sidebar=[ pmui.Typography("Controls", variant="h6"), inst._ctrl, ], theme_toggle=True ) if __name__ == "__main__": Dashboard.create_app().show(port=5007, autoreload=True, open=True) elif pn.state.served: Dashboard.create_app().servable() ``` -------------------------------- ### configure Source: https://context7.com/legout/panel-siemens-ix/llms.txt Applies Siemens iX branding globally to Panel Material UI pages. This function sets default themes (light and dark), Siemens logos, favicon, and title styling. It should be called before constructing `pmui.Page` objects. ```APIDOC ## configure(with_logo=True) ### Description One-call global setup. Sets `pmui.Page` defaults for `theme_config` (both light/dark Siemens iX themes), Siemens SVG logos (light/dark variants), the intranet favicon, title styling via `sx`, and the session disconnect notification. Must be called before constructing `pmui.Page` objects; results are cached so repeated calls are free. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```python import panel as pn import panel_material_ui as pmui from panel_siemens_ix import configure # Apply complete Siemens iX branding globally (logos, favicon, themes, sx defaults) configure() # with Siemens logos # configure(with_logo=False) # suppress logos for white-label use pn.extension(notifications=True) class MyApp(pn.viewable.Viewer): import param counter = param.Integer(default=0) def __init__(self, **params): super().__init__(**params) with pn.config.set(sizing_mode="stretch_width"): self._btn = pmui.Button( name="Increment", button_type="primary", icon="add", on_click=lambda e: setattr(self, "counter", self.counter + 1) ) self._label = pmui.Typography(object=self._count_text, variant="h5") self._layout = pmui.Container(self._label, self._btn) @pn.depends("counter") # reactive: re-renders when counter changes def _count_text(self): return f"Count: {self.counter}" def __panel__(self): return self._layout @classmethod def create_app(cls): # theme_config, logo, favicon all pre-configured by configure() return pmui.Page( title="My iX App", main=[cls()], theme_toggle=True # built-in light/dark toggle ) if __name__ == "__main__": MyApp.create_app().show(port=5007, autoreload=True, open=True) elif pn.state.served: MyApp.create_app().servable() ``` ### Response None (This function modifies global state) ``` -------------------------------- ### Develop Panel App with Hot Reload Source: https://github.com/legout/panel-siemens-ix/blob/main/examples/EXAMPLES_SUMMARY.md Run a specific Panel application with hot reload enabled for development, specifying a custom port. ```bash # Install dependencies uv sync --group dev # Run with hot reload panel serve examples/basic/component_showcase.py --dev --show --port 5007 ``` -------------------------------- ### Access Siemens iX Colors and Palettes Source: https://github.com/legout/panel-siemens-ix/blob/main/README.md Illustrates how to retrieve semantic colors and generate palettes for data visualization using the library's color system. Supports both light and dark themes. ```python from panel_siemens_ix.colors import get_colors, get_continuous_cmap, get_categorical_palette # Get colors for current theme colors = get_colors("light") # or "dark" # Access semantic colors primary_color = colors.primary["main"] success_color = colors.success["main"] warning_color = colors.warning["main"] # Generate palettes for data visualization categorical_palette = get_categorical_palette(dark_theme=False, n_colors=8) continuous_colormap = get_continuous_cmap(dark_theme=False) ``` -------------------------------- ### create_theme Source: https://context7.com/legout/panel-siemens-ix/llms.txt Generates a Material-UI theme dictionary based on the Siemens iX color system for a specified mode (light or dark). This dictionary can be used for manual or partial integration into Panel Material UI applications. ```APIDOC ## create_theme(mode="light" | "dark") ### Description Generates a complete Material-UI theme dictionary from the Siemens iX color system for the specified mode. Returns a plain `dict` compatible with the `theme_config` parameter of `pmui.Page`. Raises `ValueError` for invalid mode values. The dictionary covers `palette`, `typography` (Siemens Sans, h1–h6, body, button, caption), `components` (MuiButton, MuiChip, MuiTextField, MuiPaper, MuiAppBar, MuiButtonBase), and `shape`/`spacing`. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```python import panel_material_ui as pmui import panel as pn from panel_siemens_ix.theme import create_theme, siemens_ix_light_theme, siemens_ix_dark_theme pn.extension() # Inspect a generated theme light = create_theme("light") dark = create_theme("dark") print(light["palette"]["primary"]["main"]) print(dark["palette"]["primary"]["main"]) print(light["typography"]["fontFamily"]) print(light["shape"]["borderRadius"]) print(light["spacing"]) ``` ### Response #### Success Response (200) - **dict**: A Material-UI theme dictionary. #### Response Example ```json { "palette": { "primary": { "main": "#007993" } }, "typography": { "fontFamily": "\"Siemens Sans\", \"Arial\", sans-serif" }, "shape": { "borderRadius": 2 }, "spacing": 8 } ``` ``` -------------------------------- ### Generate Siemens iX Material-UI Theme Source: https://context7.com/legout/panel-siemens-ix/llms.txt Create a Material-UI theme dictionary for light or dark mode using `create_theme()`. This dictionary can be used with `pmui.Page`'s `theme_config` parameter. Inspect theme properties like palette, typography, and spacing. ```python import panel_material_ui as pmui import panel as pn from panel_siemens_ix.theme import create_theme, siemens_ix_light_theme, siemens_ix_dark_theme pn.extension() # Inspect a generated theme light = create_theme("light") dark = create_theme("dark") print(light["palette"]["primary"]["main"]) # '#007993' print(dark["palette"]["primary"]["main"]) # '#00cccc' print(light["typography"]["fontFamily"]) # '"Siemens Sans", "Arial", sans-serif' print(light["shape"]["borderRadius"]) # 2 print(light["spacing"]) # 8 ``` -------------------------------- ### Generate and Use Continuous Colormaps Source: https://context7.com/legout/panel-siemens-ix/llms.txt Generates 128-step colormaps for both light and dark themes. Useful for visualizations like hvPlot heatmaps or converting to Plotly colorscales. ```python from panel_siemens_ix.colors import get_continuous_cmap cmap_light = get_continuous_cmap(dark_theme=False, n_colors=128) cmap_dark = get_continuous_cmap(dark_theme=True, n_colors=128) print(len(cmap_light)) # 128 print(cmap_light[0]) # '#f3f3f0' (paper background, light start) print(cmap_dark[0]) # '#37374d' (surface, dark start) ``` ```python import hvplot.pandas import pandas as pd import numpy as np size = 15 matrix = pd.DataFrame(np.random.randn(size, size)) chart = matrix.hvplot.heatmap(cmap=cmap_light, colorbar=True, height=400, responsive=True) ``` ```python import plotly.graph_objects as go def to_plotly_colorscale(cmap): step = max(1, len(cmap) // 10) scale = [[i / len(cmap), cmap[i]] for i in range(0, len(cmap), step)] scale.append([1.0, cmap[-1]]) return scale fig = go.Figure(go.Heatmap( z=np.random.randn(15, 15), colorscale=to_plotly_colorscale(cmap_light), showscale=True )) fig.update_layout(height=400) fig.show() ``` -------------------------------- ### Apply Manual Siemens iX Theme to a Page Source: https://context7.com/legout/panel-siemens-ix/llms.txt Manually applies the Siemens iX theme to a Panel page without logos or favicons. Configure light and dark themes, and add components like typography, buttons, and alerts. ```python import panel_material_ui as pmui from panel_siemens_ix.theme import siemens_ix_light_theme, siemens_ix_dark_theme app = pmui.Page( title="Manual Theme App", theme_config={ "light": siemens_ix_light_theme, # pre-built alias for create_theme("light") "dark": siemens_ix_dark_theme, # pre-built alias for create_theme("dark") }, main=[ pmui.Typography("Siemens iX Theme", variant="h4"), pmui.Button(name="Primary", button_type="primary"), pmui.Button(name="Outlined", button_type="primary", variant="outlined"), pmui.Alert(object="Themed with Siemens iX colors!", alert_type="info"), ], theme_toggle=True, ) app.servable() ``` -------------------------------- ### Convert Hex/RGBA to RGBA String Source: https://context7.com/legout/panel-siemens-ix/llms.txt Utility to convert hex color strings or existing RGBA strings to a new RGBA string with a specified alpha value. Useful for creating transparent overlays or modifying existing transparency. ```python from panel_siemens_ix.colors import _hex_to_rgba, get_colors colors = get_colors("light") primary = colors.primary["main"] # '#007993' # Convert to rgba with transparency transparent = _hex_to_rgba(primary, 0.08) # 'rgba(0, 121, 147, 0.08)' semi = _hex_to_rgba(primary, 0.5) # 'rgba(0, 121, 147, 0.5)' opaque = _hex_to_rgba(primary, 1.0) # 'rgba(0, 121, 147, 1.0)' rgb_only = _hex_to_rgba(primary) # 'rgb(0, 121, 147)' # Re-alpha an existing rgba string existing = "rgba(0, 204, 204, 0.45)" rebased = _hex_to_rgba(existing, 0.2) # 'rgba(0, 204, 204, 0.2)' ``` ```python import panel_material_ui as pmui # Assuming 'primary' is defined as in the previous example # primary = _hex_to_rgba(colors.primary["main"]) btn = pmui.Button( name="Custom Hover", button_type="primary", sx={"&:hover": {"backgroundColor": _hex_to_rgba(primary, 0.15)}} ) ``` -------------------------------- ### Generate Continuous Color Map Source: https://context7.com/legout/panel-siemens-ix/llms.txt Generates a perceptually uniform three-part gradient as a list of hex color strings. Suitable for heatmaps, choropleth maps, and sequential color encoding in both light and dark themes. ```python from panel_siemens_ix.colors import get_continuous_cmap import plotly.graph_objects as go import pandas as pd, numpy as np ``` -------------------------------- ### get_continuous_cmap Source: https://context7.com/legout/panel-siemens-ix/llms.txt Generates a perceptually uniform three-part gradient colormap as a list of hex color strings, suitable for sequential data visualization like heatmaps. ```APIDOC ## get_continuous_cmap(dark_theme=False, n_colors=128) ### Description Generates a perceptually uniform three-part gradient as a list of hex color strings. For the light theme, transitions from paper background (`#f3f3f0`) through primary (`#007993`) to deep navy (`#002949`). For dark, from surface (`#37374d`) through teal (`#00C1B6`) to primary cyan (`#00cccc`). Suitable for heatmaps, choropleth maps, and any sequential color encoding. ### Parameters #### Query Parameters - **dark_theme** (boolean) - Optional - If True, generates the colormap for the dark theme. Defaults to False. - **n_colors** (integer) - Optional - The number of colors in the generated colormap. Defaults to 128. ### Request Example ```python from panel_siemens_ix.colors import get_continuous_cmap import plotly.graph_objects as go import pandas as pd, numpy as np # Generate a continuous colormap for the light theme light_cmap = get_continuous_cmap(dark_theme=False, n_colors=128) # Generate a continuous colormap for the dark theme dark_cmap = get_continuous_cmap(dark_theme=True, n_colors=128) # Example usage with Plotly for a heatmap data = np.random.rand(10, 10) fig = go.Figure(data=go.Heatmap(z=data, colorscale=light_cmap)) fig.show() ``` ### Response #### Success Response (200) - **colormap** (list) - A list of hex color strings representing the continuous colormap. ### Response Example ```json [ "#f3f3f0", "#f2f1ef", "#f1f0ee", ... "#007993", ... "#002949" ] ``` ``` -------------------------------- ### get_categorical_palette Source: https://context7.com/legout/panel-siemens-ix/llms.txt Generates a list of hex color strings optimized for categorical data visualization. It can return semantic colors for small counts or sample intelligently from the chart palette for larger counts, with options for dark themes and opacity. ```APIDOC ## get_categorical_palette(dark_theme=False, n_colors=17, primary=False, opacity=False) ### Description Returns a list of hex color strings optimized for categorical data visualization. For `n_colors <= 5`, returns the five semantic colors (primary, success, warning, error, info). For larger counts, samples from the 17-slot chart palette using an intelligent sequence that maximizes perceptual distance. When `n_colors > 17`, extends the palette by generating additional colors via `pmui.theme.generate_palette`. The `opacity=True` flag returns the 40%-opacity (`-40`) variants for stacked/filled charts. ### Parameters #### Query Parameters - **dark_theme** (boolean) - Optional - If True, uses the dark theme color scheme. Defaults to False. - **n_colors** (integer) - Optional - The number of colors to generate. Defaults to 17. - **primary** (boolean) - Optional - If True, generates a monochromatic palette based on the primary color. Defaults to False. - **opacity** (boolean) - Optional - If True, returns 40% opacity variants of the colors. Defaults to False. ### Request Example ```python from panel_siemens_ix.colors import get_categorical_palette import panel_material_ui as pmui # Small semantic palette (≤5 colors) palette_3 = get_categorical_palette(dark_theme=False, n_colors=3) # ['#007993', '#01893a', '#e9c32a'] — primary, success, warning # Standard 8-color categorical palette for light theme palette_8 = get_categorical_palette(dark_theme=False, n_colors=8) # 8-color categorical palette for dark theme palette_8_dark = get_categorical_palette(dark_theme=True, n_colors=8) # 40%-opacity variants for area/stacked charts palette_opaque = get_categorical_palette(dark_theme=True, n_colors=5, opacity=True) # Returns hex codes ending in '66' suffix (40% alpha) # Primary-color monochromatic palette primary_palette = get_categorical_palette(primary=True, n_colors=6) # Use with hvPlot import pandas as pd, numpy as np df = pd.DataFrame({"date": pd.date_range("2024-01-01", periods=50), "A": np.random.randn(50).cumsum(), "B": np.random.randn(50).cumsum()}) import hvplot.pandas chart = df.hvplot.line(y=["A","B"], cmap=palette_8[:2], line_width=2) # Use with Plotly Express import plotly.express as px fig = px.scatter(df.melt("date"), x="date", y="value", color="variable", color_discrete_sequence=palette_8) ``` ### Response #### Success Response (200) - **palette** (list) - A list of hex color strings representing the categorical color palette. ### Response Example ```json [ "#007993", "#01893a", "#e9c32a", "#007993", "#01893a", "#e9c32a", "#007993", "#01893a" ] ``` ``` -------------------------------- ### Access Siemens iX Color Palette Tokens Source: https://context7.com/legout/panel-siemens-ix/llms.txt Provides direct access to the Siemens iX color palette via frozen dataclasses. Useful for inspecting available colors or building custom themes. ```python from panel_siemens_ix.colors import SiemensIXLightColors, SiemensIXDarkColors light = SiemensIXLightColors() dark = SiemensIXDarkColors() # Enumerate all color groups import dataclasses groups = [f.name for f in dataclasses.fields(light)] # ['primary','dynamic','secondary','text','background','error','warning', # 'info','success','ghost','component','border','neutral','shadow','chart'] # Access component-level tokens print(light.border["std"]) # '#0000284d' print(light.border["focus"]) # '#1491EB' print(dark.ghost["selected"]) # '#00ffb91f' print(dark.component["3"]) # '#ffffff4d' ``` ```python import json # Serialize to plain dict (e.g., for JSON export or custom MUI theme building) palette_dict = light.to_dict() print(json.dumps(palette_dict["warning"], indent=2)) # { # "main": "#e9c32a", # "hover": "#e3ba17", # "active": "#d0ab15", # "contrast": "#000028" # } ``` ```python import panel_material_ui as pmui # Build a custom sx override using raw palette tokens chip = pmui.Chip( label="Custom Chip", sx={ "backgroundColor": dark.primary["main"], "color": dark.primary["contrast"], "&:hover": {"backgroundColor": dark.primary["hover"]}, } ) ``` -------------------------------- ### get_colors Source: https://context7.com/legout/panel-siemens-ix/llms.txt Retrieves the full Siemens iX color palette for either light or dark mode. The returned object contains color groups like primary, secondary, and chart colors, each with various shades (main, hover, active, etc.). ```APIDOC ## get_colors(mode="light" | "dark") ### Description Returns the frozen dataclass instance (`SiemensIXLightColors` or `SiemensIXDarkColors`) containing the full Siemens iX color palette for the requested mode. Each color group (primary, secondary, dynamic, error, warning, info, success, ghost, component, border, neutral, shadow, chart) is a `dict[str, str]` of hex/rgba values keyed by variant (`main`, `hover`, `active`, `contrast`, `disabled`, …). ### Parameters #### Query Parameters - **mode** (string) - Required - Specifies the theme mode, either 'light' or 'dark'. ### Request Example ```python from panel_siemens_ix.colors import get_colors light = get_colors("light") dark = get_colors("dark") # Semantic colors print(light.primary["main"]) print(light.primary["hover"]) print(light.primary["active"]) print(light.primary["contrast"]) print(dark.primary["main"]) print(dark.success["main"]) print(dark.error["main"]) print(dark.warning["main"]) # Background / surface print(light.background["default"]) print(light.background["paper"]) print(dark.background["default"]) print(dark.background["surface"]) # Text hierarchy print(light.text["primary"]) print(light.text["secondary"]) print(light.text["disabled"]) # Chart palette (17 colors + 40%-opacity variants) print(light.chart["1"]) print(light.chart["1-40"]) print(dark.chart["1"]) # Export as plain dict import json print(json.dumps(light.to_dict()["primary"], indent=2)) ``` ### Response #### Success Response (200) - **color_palette** (object) - An object containing color definitions for the specified mode. - **primary** (dict) - Primary color variants. - **secondary** (dict) - Secondary color variants. - **dynamic** (dict) - Dynamic color variants. - **error** (dict) - Error color variants. - **warning** (dict) - Warning color variants. - **info** (dict) - Info color variants. - **success** (dict) - Success color variants. - **ghost** (dict) - Ghost color variants. - **component** (dict) - Component color variants. - **border** (dict) - Border color variants. - **neutral** (dict) - Neutral color variants. - **shadow** (dict) - Shadow color variants. - **chart** (dict) - Chart color variants. ### Response Example ```json { "primary": { "main": "#007993", "hover": "#196269", "active": "#16565c", "contrast": "#ffffff", "disabled": "#0079934d" }, "background": { "default": "#ffffff", "paper": "#f3f3f0" }, "text": { "primary": "#000028", "secondary": "#00002899", "disabled": "#0000284d" }, "chart": { "1": "#007993", "1-40": "#00799366" } } ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.