question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Proposal: Add HsvColor Struct and HsvColor Property to ColorPicker

See original GitHub issue

Proposal: Add HsvColor Struct and HsvColor Property to ColorPicker

Summary

  1. Add a new HsvColor struct to WinUI. The struct should support the properties below. The design is based on the Windows Community Toolkit implementation.
// The hue channel 0..359
public double H { get; }

// The saturation channel 0..1 (a percentage)
public double S { get; }

//  The value channel 0..1 (a percentage)
public double V { get; }

// The alpha channel 0..1 (a percentage)
public double A { get; }
  1. Add an HsvColor property to the ColorPicker itself
  2. Switch the ColorSpectrum HsvColor property to use the HsvColor struct instead of Vector4

Rationale

The color picker internally works in HSV. If applications require high color precision they cannot be converting to/from RGB and HSV repeatedly or the values will drift.

It also makes sense to expose the HSV color to clean-up internal ColorPicker code that shares the value between components.

Scope

Capability Priority
Add a new HsvColor struct Must
Expose the internal HsvColor in the ColorPicker Must
Expose conversion methods from RGB <-> HSV Must
Rework internal ColorPicker/ColorSpectrum code to use HsvColor instead of Vector4 Should

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
chingucodingcommented, Sep 26, 2020

Oh I see, that would also work. Maybe that would be a must then, after all we are already adding a separate API here for the ColorPicker and introducing just the HSV struct without any conversion helpers seems a bit lacking.

1reaction
chingucodingcommented, Sep 26, 2020

The proposal does not require it, but I think it would make sense to provide it. Maybe it should be required, having to implement the conversion yourself doesn’t sound like a great experience.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Two new color spaces for color picking - Okhsv and Okhsl
Okhsv and Okhsl Two new color spaces for color picking This post has an accompanying interactive comparison of color pickers. I would...
Read more >
Building a Color Picker with GDI+ in Visual Basic .NET or ...
Coincidentally, I ran across an application using a dialog box that allows users to select colors using the HSV color scheme (much like...
Read more >
My Version of the Ubiquitous Color Picker
An article describing a color picker with independent control of seven variables and dynamically updating slider backgrounds.
Read more >
VR Color Picker
ABSTRACT In this paper, we propose a 3D color picker for virtual reality (VR) systems. Using the proposed color picker, the RGB and...
Read more >
New alternatives to HSL and HSV that better match color ...
I like using perceptual spaces because they are self-evidently a “neater” starting point for colour work than something artificially distorted ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found