sindresorhus/refined-github

Add color wheel for picking label colors #2224

allejo posted onGitHub

I may just be overcomplicating a simple feature within GitHub, but when selecting colors for my labels, I always randomly shuffle colors. Sometimes I find a color I like but my obsessiveness drives me to find a slightly different shade of that color.

Would anyone else want a color picker to exist?

Example URL: https://github.com/sindresorhus/refined-github/labels

I'd imagine it'd look something like this:

image


posted by sindresorhus over 5 years ago

Sure, that'd suit my needs perfectly!

posted by allejo over 5 years ago

If you have Tampermonkey installed, I have a userscript that'll do this - https://github.com/Mottie/GitHub-userscripts/wiki/GitHub-label-color-picker

posted by Mottie over 5 years ago

This is extremely easy:

for (const field of select.all('.js-new-label-color-input')) {
    field.type = 'color';
}

Anyone who wants it, just needs to create a feature called label-color-picker and add documentation for it. Follow contribute.md

posted by fregante over 5 years ago

I really like @fregante's solution mentioned above, it's quick and neat.

But with that you are still restricted on how your browser/OS handles color inputs, and on limitations of text preview for the color being selected, which is solved using @Mottie's script.

If we do not need preview (which is very unlikely IMHO), we can easily go with @fregante's solution. But as I see it, I prefer the text input over the native color input mainly because of the aforementioned reasons (no real-time preview of color).

posted by notlmn over 5 years ago

I chose to use a third party color picker because it saved color swatches, which makes it easier to duplicate label colors across repositories. I haven't tried lately, but I don't think GitHub supports this sort of label duplication.

posted by Mottie over 5 years ago

I guess the alternative is to duplicate the field and bind them together (text field updates color field and viceversa). Something like:

for (const field of select.all('.js-new-label-color-input')) {
    field.after(<input type="color" className={field.className} style={{width:'2em'}} />);
}
delegate('.js-new-label-color-input', 'input', event => {
    event.delegateTarget.nextElementSibling.value = event.delegateTarget.value;
});
delegate('.js-new-label-color-input + input', 'input', event => {
    event.delegateTarget.previousElementSibling.value = event.delegateTarget.value;
});

However it would look like:

<img width="193" alt="Screenshot 2019-09-14 at 22 45 38" src="https://user-images.githubusercontent.com/1402241/64910511-65117600-d741-11e9-9e57-47f7e79f8097.png">

posted by fregante over 5 years ago

I've started work on this!

You can view my code on my label-color-picker branch.

posted by johnletey over 5 years ago

@jerone has funded $5.00 to this issue.


posted by issuehunt-app[bot] over 5 years ago

I've made a PR here #2591 with the enhancement. But I closed it by accident, since it is my first PR on a big project and didn't know what is the workflow to submit a PR. I will appreciate some help on reopenning the PR, apparently I don't have the necesary privileges. Or maybe I'll have to upload another branch, I don't know.

The feature I've built has some little bugs that are commented on the file with FIXME tags: The most important is that if you press the "save button" to save the new color for your label, if you press the edit button again on the same label, the color palette will disappear. You will have to refresh the whole page again to see the color palette if you will like to edit the same label color again.

posted by KarlHeitmann over 5 years ago

The PR can’t be reopened because the branch was deleted. Maybe try to restore the branch and then reopen.

Also include a screenshot in your PR discussion to see how it looks first

posted by fregante over 5 years ago

Thanks, I'll take a look

posted by KarlHeitmann over 5 years ago

I think the userscript will have to do, we don't have to include every feature.

posted by fregante over 4 years ago

@sindresorhus has cancelled @jerone's funding for this issue.(Cancelled amount: $5.00) See it on IssueHunt

posted by issuehunt-app[bot] about 4 years ago

Fund this Issue

$0.00
Funded

Pull requests

Recent activities

sindresorhus cancelled funding 5.00 for  sindresorhus/ refined-github#2224
about 4 years ago
jerone funded 5.00 for sindresorhus/refined-github# 2224
over 5 years ago