Skip to content

Create specific points for the gradient #8

@psiphi75

Description

@psiphi75

@psiphi75 I was wondering if the gradient could be done the other way around, mapping dB threshold values to colours?

So something like..

let mut gradient = ColourGradient::new();
gradient.add_colour(RGBAColour::new(-100.0, 0, 0, 0, 255));     // Black - I was originally thinking -f32::INFINITY but it might be better to define a lower bound
gradient.add_colour(RGBAColour::new(-60.0, 55, 0, 110, 255));  // Purple
gradient.add_colour(RGBAColour::new(-40.0, 0, 0, 180, 255));   // Blue
gradient.add_colour(RGBAColour::new(-20.0, 0, 255, 255, 255)); // Cyan
gradient.add_colour(RGBAColour::new(-10.0, 255, 255, 0, 255)); // Green
gradient.add_colour(RGBAColour::new(-0.0, 255, 0, 0, 255));   // Red

This way you could define a minimum and maximum amplitude range, and generating the gradient would be much easier outside the package as the same colour stops can be calculated based on that range. What do you think?

Originally posted by @juho in #6 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions