Skip to content

Commit

Permalink
Preset palettes (#2494)
Browse files Browse the repository at this point in the history
* Add swatches to color picker

* Update swatch colors

* Fix code style

* Update CHANGES and docs

* Move change log to section 3.8
  • Loading branch information
javerbukh authored Oct 6, 2023
1 parent 9dfab3a commit 9f0b7a4
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)
==================

Expand Down
6 changes: 3 additions & 3 deletions docs/specviz/displaying.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
----------
Expand Down
10 changes: 10 additions & 0 deletions jdaviz/configs/default/plugins/plot_options/plot_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
['#FFD300', '#AAAA00', '#555500'],
['#4CFF00', '#00AA00', '#005500'],
['#00FF8E', '#00AAAA', '#005555'],
['#0089FF', '#5200FF', '#000055']
]

def is_profile(state):
return isinstance(state, (ProfileViewerState, ProfileLayerState))

Expand Down
5 changes: 4 additions & 1 deletion jdaviz/configs/default/plugins/plot_options/plot_options.vue
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,10 @@
</template>
<div @click.stop="" style="text-align: end; background-color: white">
<v-color-picker :value="image_color_value"
@update:color="throttledSetValue('image_color_value', $event.hexa)"></v-color-picker>
:swatches="swatches_palette"
show-swatches
@update:color="throttledSetValue('image_color_value', $event.hexa)"
></v-color-picker>
</div>
</v-menu>
</div>
Expand Down

0 comments on commit 9f0b7a4

Please sign in to comment.