A user reported an issue where typing a specific color code in the category text field automatically reverts to a different color. alltiagocom demonstrated the problem with the color code f2f2f2 reverting to ff22ff. dax confirmed the bug and suggested a temporary workaround of copying and pasting the hex value. davidb provided a fix, but alltiagocom reported it was still not working as expected. alltiagocom suggested improvements to the hex code handling, such as ignoring the # symbol and evaluating more than six characters. davidb acknowledged the suggestions and proposed a change to prevent the form from changing the text color value while typing. alltiagocom offered further suggestions to make the hex code input more flexible and user-friendly.
I was trying to type f2f2f2, but I can only type f2. The moment I try to type the second f (like f2f) it reverts to ff22ff automatically. This happens on both the Color and Text Color when trying to create a new category (or editing it).
I’m not a developer, so I don’t know this on a deeper level, but looking at the commit, it says: // auto fill common hex codes like #F8F -> #F8F8F8 and #DDD -> #DDDDDD
Why would it behave this way?
I see how adding fff and hitting save would automatically save as ffffff, but while typing, there should be no auto fill happening in real time (if that’s what’s happening).
What if I want to type f2ff32? Right now, I’m stuck to it always defaulting to f2f2f2, which was the issue on my OP.
I took a shot at improving the suggestions from the autocomplete hex feature initially. Though I think the only real solution here is to prevent the form from changing the text color value while you are typing.
We do still need to check the value to try and ensure we have a valid hex code, but I’ve changed the approach so that it only checks the value if you click or tab out of the field or when submitting the form.
It always evaluates the first 6 characters, so even if I have f2f299f2, it will assume it’s f2f299.
It can completely ignore #, which sometimes that’s what we get from certain apps (for example Shottr gives me the full #f2f2f2). It allows people to just copy and paste whatever they get from an app or even how they’re used to type the hex code. So type/pasting #f2f2f2, f2f2f2, #f2f2f29393, or f2f2f29393 would get the same color.
Both of these approaches would make it super flexible. If I get #f2f2f2 from an app, it won’t cut the last 2, because it’s not limited to just 6 characters, and it still accept it as a color, because it’s ignoring the #.
Then, when it saves the category, it removes the # and any extra characters above 6.
What do you think?
It can still auto-complete on save for certain colors such as fff, 000, 111, etc.