Skip to content

Add ability to select coloscheme for spectrogram #142

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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

naglepuff
Copy link
Collaborator

@naglepuff naglepuff commented Apr 9, 2025

Fix #133

Adds the ability to select a color scheme to apply to the spectrogram on the front end. The "0" value can be set as well (defaults to black). Also adds the ability to change the default color scheme on the Admin page.

@naglepuff naglepuff force-pushed the issue-133-alt-color-scheme branch from 4a6ab84 to 426f473 Compare April 10, 2025 21:23
@naglepuff naglepuff force-pushed the issue-133-alt-color-scheme branch from 426f473 to 5223263 Compare April 10, 2025 21:28
@naglepuff naglepuff marked this pull request as ready for review April 10, 2025 21:31
@naglepuff naglepuff requested a review from BryonLewis April 10, 2025 21:33
Copy link
Collaborator

@BryonLewis BryonLewis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few suggestions:

  • Remove Alpha selection from background color picker
  • Maybe add a default background color to go along with the color scheme
  • Suggestion on representation of the color scheme in the color scheme picker through a custom component
  • Swapping watch effect to a more explicit watch

@@ -48,6 +48,7 @@ export default defineComponent({
blackBackground,
scaledVals,
configuration,
colorScheme,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably used in testing but doesn't seem to be used in this field anymore?

const gValues = ref('');
const bValues = ref('');

watchEffect(() => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be switched to a more explicit watch (I know it may have a few variables it is watching, such as backgroundColor and colorScheme)? I've just been bitten in the past by watchEffect getting large and making it difficult to determine the triggering variable/function.

Below is just an explanation of why I have an aversion to watchEffect ,but I'm open to have my mind changed:
It was a more complicated instance with other issues, but the watchEffect made it difficult to track the logic down. A codebase I was being onboarded on had a function that modified a ref, that function was passed a prop into a child component that was renamed and then used in a large (~200 line watchEffect). The chaining and the name changes made it difficult for me to determine why and where the variable was changing.

Comment on lines 523 to 528
<v-color-picker
v-model="backgroundColor"
elevation="0"
/>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add mode='hex' or mode='rgb' to the attributes on this component. It will remove the alpha portion of the selector. Really isn't needed because I don't think it would apply to the background color.

Comment on lines +493 to +505
<v-select
v-model="colorScheme"
label="Color Scheme"
:items="colorSchemes"
item-title="title"
item-value="scheme"
variant="outlined"
density="compact"
width="75"
hide-details
return-object
/>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we may want to include an indication of the color scheme mostly because I don't know off hand what those names mean.

Something like this:
image
I included a component that can be used as a base (it's a text file because github doesn't like .vue files). It's just a custom V-select that provides a visual indication of the color scheme. Feel free to modify anything in it (I did the highlighting and border stuff quick for the individual items).
I think this or something like this should replace the configuration color picker as well.

ColorSchemePicker.txt

Comment on lines +27 to +31
default_color_scheme = models.CharField(
max_length=20,
choices=AvailableColorScheme.choices,
default=AvailableColorScheme.INFERNO,
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're adding a default color scheme should there be a default background color as well?

@naglepuff naglepuff force-pushed the issue-133-alt-color-scheme branch from bc844ca to 9e6c1ff Compare April 14, 2025 18:49
@naglepuff naglepuff force-pushed the issue-133-alt-color-scheme branch from 9e6c1ff to 310df37 Compare April 22, 2025 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Alternate Color Scheme Testing
2 participants