From f3794f5deacceb731e856363580a66501380bf5c Mon Sep 17 00:00:00 2001 From: yunji Date: Tue, 23 Jan 2024 20:39:07 +0800 Subject: [PATCH] feat: set_theme --- bindings/pyl7vp/pyl7vp/l7vp.py | 10 +++++++++- bindings/pyl7vp/pyl7vp/templates/l7vp.html | 8 +++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/bindings/pyl7vp/pyl7vp/l7vp.py b/bindings/pyl7vp/pyl7vp/l7vp.py index 7a7cf720..7a1d9bb0 100644 --- a/bindings/pyl7vp/pyl7vp/l7vp.py +++ b/bindings/pyl7vp/pyl7vp/l7vp.py @@ -102,6 +102,8 @@ def __init__(self, height=600, datasets: list = [], config: dict = {}): _validate_config(config) self.config = _merge_config(DEFAULT_ANALYSIS_SPEC, config) + self.set_theme() + # page settting self.page_title = "PyL7VP" @@ -154,6 +156,13 @@ def _dump_js_datasets( datasets = list(map(lambda d: _dataset_auto_create_layers(d, self.config.get("layers")), self.datasets)) return json_dump_to_js(datasets) + ''' + set the l7vp theme "dark" or "light", default "dark" + ''' + + def set_theme(self, theme: str = "dark"): + self.theme = theme + ''' get render to html string ''' @@ -184,7 +193,6 @@ def _get_html_str( } self.read_only = read_only - self.theme = "dark" # get html string return Engine(env=env).render( diff --git a/bindings/pyl7vp/pyl7vp/templates/l7vp.html b/bindings/pyl7vp/pyl7vp/templates/l7vp.html index f3ecc830..a398e599 100644 --- a/bindings/pyl7vp/pyl7vp/templates/l7vp.html +++ b/bindings/pyl7vp/pyl7vp/templates/l7vp.html @@ -71,6 +71,12 @@ {% if l7vp.app_mode %}