From 80869c868b735851d23e98b942df4eb838fd5180 Mon Sep 17 00:00:00 2001 From: Jesse Averbukh Date: Wed, 4 Oct 2023 14:31:09 -0400 Subject: [PATCH 1/5] Add swatches to color picker --- .../default/plugins/plot_options/plot_options.py | 10 ++++++++++ .../default/plugins/plot_options/plot_options.vue | 5 ++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/jdaviz/configs/default/plugins/plot_options/plot_options.py b/jdaviz/configs/default/plugins/plot_options/plot_options.py index dc7ddfeea9..2802164b4c 100644 --- a/jdaviz/configs/default/plugins/plot_options/plot_options.py +++ b/jdaviz/configs/default/plugins/plot_options/plot_options.py @@ -265,11 +265,21 @@ class PlotOptions(PluginTemplateMixin): show_viewer_labels = Bool(True).tag(sync=True) + swatches_palette = List().tag(sync=True) + def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.viewer = ViewerSelect(self, 'viewer_items', 'viewer_selected', 'multiselect') self.layer = LayerSelect(self, 'layer_items', 'layer_selected', 'viewer_selected', 'multiselect') # noqa + self.swatches_palette = [ + ['#FF0000', '#AA0000', '#550000'], + ['#FFFF00', '#AAAA00', '#555500'], + ['#00FF00', '#00AA00', '#005500'], + ['#00FFFF', '#00AAAA', '#005555'], + ['#0000FF', '#0000AA', '#000055'] + ] + def is_profile(state): return isinstance(state, (ProfileViewerState, ProfileLayerState)) diff --git a/jdaviz/configs/default/plugins/plot_options/plot_options.vue b/jdaviz/configs/default/plugins/plot_options/plot_options.vue index 471c25cee3..5d8499ddaa 100644 --- a/jdaviz/configs/default/plugins/plot_options/plot_options.vue +++ b/jdaviz/configs/default/plugins/plot_options/plot_options.vue @@ -444,7 +444,10 @@
+ :swatches="swatches_palette" + show-swatches + @update:color="throttledSetValue('image_color_value', $event.hexa)" + >
From 80338e02f6b339eac62f372aa52e954f012a160d Mon Sep 17 00:00:00 2001 From: Jesse Averbukh Date: Wed, 4 Oct 2023 14:45:41 -0400 Subject: [PATCH 2/5] Update swatch colors --- .../configs/default/plugins/plot_options/plot_options.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/jdaviz/configs/default/plugins/plot_options/plot_options.py b/jdaviz/configs/default/plugins/plot_options/plot_options.py index 2802164b4c..3aba1c04a8 100644 --- a/jdaviz/configs/default/plugins/plot_options/plot_options.py +++ b/jdaviz/configs/default/plugins/plot_options/plot_options.py @@ -274,10 +274,10 @@ def __init__(self, *args, **kwargs): self.swatches_palette = [ ['#FF0000', '#AA0000', '#550000'], - ['#FFFF00', '#AAAA00', '#555500'], - ['#00FF00', '#00AA00', '#005500'], - ['#00FFFF', '#00AAAA', '#005555'], - ['#0000FF', '#0000AA', '#000055'] + ['#FFD300', '#AAAA00', '#555500'], + ['#4CFF00', '#00AA00', '#005500'], + ['#00FF8E', '#00AAAA', '#005555'], + ['#0089FF', '#5200FF', '#000055'] ] def is_profile(state): From bd6beefcb05e0d634003e78d6c1aaef7ca683ac1 Mon Sep 17 00:00:00 2001 From: Jesse Averbukh Date: Thu, 5 Oct 2023 09:08:56 -0400 Subject: [PATCH 3/5] Fix code style --- jdaviz/configs/default/plugins/plot_options/plot_options.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdaviz/configs/default/plugins/plot_options/plot_options.py b/jdaviz/configs/default/plugins/plot_options/plot_options.py index 3aba1c04a8..3fbbbb6369 100644 --- a/jdaviz/configs/default/plugins/plot_options/plot_options.py +++ b/jdaviz/configs/default/plugins/plot_options/plot_options.py @@ -278,7 +278,7 @@ def __init__(self, *args, **kwargs): ['#4CFF00', '#00AA00', '#005500'], ['#00FF8E', '#00AAAA', '#005555'], ['#0089FF', '#5200FF', '#000055'] - ] + ] def is_profile(state): return isinstance(state, (ProfileViewerState, ProfileLayerState)) From 3d9a3a7708fee41eef604065d771b796d6cbb4e6 Mon Sep 17 00:00:00 2001 From: Jesse Averbukh Date: Fri, 6 Oct 2023 10:11:14 -0400 Subject: [PATCH 4/5] Update CHANGES and docs --- CHANGES.rst | 2 ++ docs/specviz/displaying.rst | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index bc6d74c26d..aff9224d45 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -98,6 +98,8 @@ Other Changes and Additions - Compatibility with Python 3.12. [#2473] +- Add swatches to color picker. [#2494] + 3.7 (2023-09-21) ================ diff --git a/docs/specviz/displaying.rst b/docs/specviz/displaying.rst index 2909d874a2..a84581af04 100644 --- a/docs/specviz/displaying.rst +++ b/docs/specviz/displaying.rst @@ -203,9 +203,9 @@ Layer ----- The top section of the :guilabel:`Layer` tab contains options to change the color -of the spectrum (click the |icon-color-square| icon to see a color change menu), -change visibility of the spectrum (|icon-eye| icon), and a dropdown box to select -which layer will have its settings changed. +of the spectrum (click the |icon-color-square| icon to see a color change menu +and a default color palette), change visibility of the spectrum (|icon-eye| icon), +and a dropdown box to select which layer will have its settings changed. Line Width ---------- From 196c39c6e54927e2690bed3875f0f8a633f198b6 Mon Sep 17 00:00:00 2001 From: Jesse Averbukh Date: Fri, 6 Oct 2023 15:34:41 -0400 Subject: [PATCH 5/5] Move change log to section 3.8 --- CHANGES.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index aff9224d45..fad0705f96 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -67,6 +67,8 @@ Other Changes and Additions displayed to alert users that data points are being filtered because of non-finite uncertainties (when flux is finite). [#2437] +- Add swatches to color picker. [#2494] + 3.7.1 (unreleased) ================== @@ -98,8 +100,6 @@ Other Changes and Additions - Compatibility with Python 3.12. [#2473] -- Add swatches to color picker. [#2494] - 3.7 (2023-09-21) ================