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

Preset palettes #2494

Merged
merged 5 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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