superhighfives / pika

An open-source colour picker app for macOS
https://superhighfives.com/pika
MIT License
1.71k stars 55 forks source link

Add OpenGL Color Format Support #123

Open cadupuy opened 1 month ago

cadupuy commented 1 month ago

Hello !

First of all, thank you for creating such a fantastic tool! I have a suggestion that I believe could make Pika even more awesome : It would be great to have an option to output colors in the OpenGL format (r, g, b, a), where each component ranges from 0.0 to 1.0. This feature would be incredibly useful for those of us working in graphics programming and game development.


Benefits:

  1. Expanded Use Cases: Pika would become even more valuable for developers in graphics and gaming.
  2. Time-Saving: Directly using OpenGL values without manual conversion would streamline workflows.
  3. Enhanced Flexibility: Offering multiple color formats increases Pika’s versatility.

Thank you for considering this addition. Keep up the excellent work!

superhighfives commented 1 month ago

Is this what you had in mind, @cadupuy?

image

Also, what level of precision for the decimal points would make the most sense? 0.00? 0.000? Pika doesn't handle transparencies, so I've hardcoded 1.0 for the alpha.

Let me know what you think, and thanks for the suggestion!

cadupuy commented 1 month ago

The integration, as shown in the screenshot, is well done. The issue with decimals is somewhat variable. Ideally, it would be great to have an option to adjust the precision if necessary, but that might require too many modifications on your part.

For example, in some cases, like with the color red, only one decimal place would be necessary: vec4(1.0, 0.0, 0.0, 1.0). However, for other colors, it would be important to have up to six decimal places: vec4(0.123456, 0.234567, 0.345678).

Moreover, there would be no need to manage transparency. The alpha parameter can always be set to a value of 1.0. Transparency is typically handled directly within the code.

Thank you again for considering this and for your prompt response!

superhighfives commented 1 month ago

Thanks @cadupuy.

I think the main thing I'll need to think about is this one:

For example, in some cases, like with the color red, only one decimal place would be necessary: vec4(1.0, 0.0, 0.0, 1.0). However, for other colors, it would be important to have up to six decimal places: vec4(0.123456, 0.234567, 0.345678).

Will do some noodling, and planning to get a beta up soon.