Skip to content
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

Feedback: New free language colour picker #4903

Closed
lildude opened this issue Jun 26, 2020 · 8 comments
Closed

Feedback: New free language colour picker #4903

lildude opened this issue Jun 26, 2020 · 8 comments

Comments

@lildude
Copy link
Member

lildude commented Jun 26, 2020

For a very long time now, picking a free colour has been a right pain in the 🍑 and I've been mulling various methods of easing this in one form or another.

Comments yesterday in #4900 and #4894 and a bit of free time on my hands renewed my interest, so I dug into various different methods, and finally came up with a simple HTML web page and a little bit of Javascript (⚠️ my Javascript knowledge is terrible) and built: GitHub Linguist Free Colour Picker.

Use your cursor or enter the hex manually, and it'll highlight the box at the bottom to show you how it'll look and also validate if the colour is free or not.

For example, #fdff3c isn't available:

Screenshot 2020-06-26 at 17 41 44

... but #ce00cd is:

Screenshot 2020-06-26 at 17 41 56

Have a tinker with it, lemme know what you think, and feel free to open issues and submit PRs in the repo https://github.com/lildude/linguist-free-colours

This was referenced Jun 26, 2020
@pchaigno
Copy link
Contributor

This is awesome! I love how the blue is completely saturated...

How hard do you think it'd be to grey, make black, or make white areas that are unavailable? I could try and implement that in a couple weeks (when I'll have more time) if it sounds like something that would be possible.

@lildude
Copy link
Member Author

lildude commented Jun 27, 2020

How hard do you think it'd be to grey, make black, or make white areas that are unavailable?

Oh it's possible, just incredibly time consuming as you'd need to iterate over every colour and perform the check in order to determine if the colour is free or not. This is the approach taken in https://github.com/PMunch/colourfinder and the one I initially started with, albeit in Ruby and in a slightly different form, in this project but found it too time consuming and it would require maintenance and some form of state retention and updating as the used colours change. The current approach relies solely on the languages.yml file to remain up-to-date as the colour check happens on the fly.

If you've got an idea of how to do this efficiently, go for it.

@Alhadis
Copy link
Collaborator

Alhadis commented Jun 29, 2020

I like how GitHub's designers have managed to redesign the entire website, yet still haven't reached a consensus as to whether or not colour proximity is even relevant anymore... #priorities

Oh it's possible, just incredibly time consuming as you'd need to iterate over every colour and perform the check in order to determine if the colour is free or not

I recommend generating a list of unavailable colours ahead-of-time, and configuring a webhook to regenerate the list each time a change is pushed to Linguist (I'm assuming that's possible using GitHub Actions, or what-have-you 😉). The list needn't be anything fancier than a binary file containing raw RGB values; you'd load it using something like:

const unavailableColours = new Set();
fetch("https://lildude.github.io/linguist-free-colours/unavailable")
	.then(response => response.arrayBuffer())
	.then(fileData => {
		fileData = new Uint8Array(fileData);
		for(let i = 0; i < fileData.length;
			unavailableColours.add(
				fileData[i++] << 16 |
				fileData[i++] << 8  |
				fileData[i++]
			));
	});

@stale
Copy link

stale bot commented Jul 29, 2020

This issue has been automatically marked as stale because it has not had activity in a long time. If this issue is still relevant and should remain open, please reply with a short explanation (e.g. "I have checked the code and this issue is still relevant because ___."). Thank you for your contributions.

@stale stale bot added the Stale label Jul 29, 2020
@pchaigno
Copy link
Contributor

@lildude I think this can be closed?

@stale stale bot removed the Stale label Jul 30, 2020
@lildude lildude closed this as completed Jul 30, 2020
@Alhadis
Copy link
Collaborator

Alhadis commented Jul 30, 2020

Awh, but I was just about to offer feedback. 😭

@lildude
Copy link
Member Author

lildude commented Jul 30, 2020

You still can 😁

@Alhadis
Copy link
Collaborator

Alhadis commented Jul 30, 2020

My feedback is that the colour proximity requirement needs to leave the hall. 😁

@github-linguist github-linguist locked as resolved and limited conversation to collaborators Jun 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants