Bug 500482

Summary: Color Picker plugin: Add support for 4-hexdigit colors
Product: [Applications] kate Reporter: Rob <robuhde>
Component: partAssignee: KWrite Developers <kwrite-bugs-null>
Status: CONFIRMED ---    
Severity: wishlist CC: christoph
Priority: NOR    
Version First Reported In: 24.12.2   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Rob 2025-02-20 19:48:30 UTC
I don't know if this should be classified as a bug or feature request. It may also be wider reaching than just kate, but this is the only time I've attempted to use 4-hexdigit colors.

I know in XML (and thus SVG) 4-hexdigit codes are acceptable and correctly interpreted when displayed through Firefox 135.0.1. With color picker, currently, having fill="#65D5" does not show the color picker, though it does 8 digit hex codes. If you view an SVG file with the above fill, it will be a transparent version of the normal shorthand hex color #65D. I'm not sure if this is a standard in all languages/markups so support for it might be annoying, but I did not see any mention of it so I wanted to make sure it was at least on the radar for the future.

STEPS TO REPRODUCE
1. Enable color picker in kate
2. Type a 4-hexdigit code like #65D5

OBSERVED RESULT
No color picker preview appears

EXPECTED RESULT
Color picker should show a color preview as if it were an expanded 8-hexdigit value. 

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 6.3.1
KDE Frameworks Version: 6.11.0
Qt Version: 6.8.2
Kernel Version: 6.13.2-arch1-1 (64-bit)
Graphics Platform: Wayland
Comment 1 Christoph Cullmann 2025-03-22 18:51:25 UTC
We use QColor::fromString

That seems so far not to support that string format itself:

https://doc.qt.io/qt-6/qcolor.html#fromString
Comment 2 Rob 2025-03-26 19:56:53 UTC
Ah, thanks, that would make it quite difficult. I've added a suggestion request for Qt to add support for 4-digit hex codes.
(In reply to Christoph Cullmann from comment #1)
> We use QColor::fromString
> 
> That seems so far not to support that string format itself:
> 
> https://doc.qt.io/qt-6/qcolor.html#fromString