the-via / app

GNU General Public License v3.0
765 stars 173 forks source link

[Feature request] Choose RGB color using a color code. #168

Open elias2500 opened 1 year ago

elias2500 commented 1 year ago

Hello! I'm new to the custom keyboard world and to the VIA app, so please excuse me if this feature already exists. I think it would be a good idea to be able to pick the RGB color based on a color code. I would like to match my windows accent color (#E74856) to my keyboard's RGB light. As far as I'm aware, the only way to choose the color right now is by the clocking on the color pallet. Although I might be able to get it close that way, I would be useful to be able to paste the color code (or RGB values), to instantly choose the correct color. Thanks in advance!

miccou commented 1 year ago

I'm keen to work on this 👍

miccou commented 1 year ago

@elias2500 want to try out this branch and tell me what you think? https://github.com/miccou/app/tree/issues/168

This is complex because VIA only allows a 2 dimensional colour picker where one axis is hue and one is saturation - there is no luminance component.

The way I solved this was by discarding the luminance component if you enter an RGB HEX code that doesn't already have a luminance of 1. Losing the luminance isn't an issue because this an LED light - you can just turn the brightness down.

e.g. #334455 (210°, 40%, 33%) becomes #99cbff (211°, 40%, 100%).

I'll do a bit more testing tomorrow and submit a PR.

elias2500 commented 1 year ago

Hello @miccou Thank you for looking into this and coming up with a solution so quickly! I'll be sure to take a look at the implementation. I do have a couple of extra questions for you. I'd love to contribute to this project, but I'm not sure if and how that's possible. Is there something I can read? Is this a project open to receiving this kind of contribution? Thank you very much!

miccou commented 1 year ago

@elias2500 regarding contributing to this project, I can't answer that, I am not a maintainer.

Bigger projects usually have contributing guidelines (like these from Jellyfin), but for projects without these guidelines you can either ask a maintainer if they will accept your offer to work on the codebase OR just develop a feature/fix and submit a PR and see if they will engage you via feedback or merging. For some projects, they won't, but at least you practiced software development.