Bug 367694 - Support loading palettes saved as a CSS file
Summary: Support loading palettes saved as a CSS file
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Resource Management (show other bugs)
Version: 2.9.7
Platform: Ubuntu Linux
: NOR wishlist
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-08-22 20:45 UTC by hokmaph
Modified: 2024-07-05 08:25 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description hokmaph 2016-08-22 20:45:34 UTC
I'm trying to upload a css palette into krita but don't work

Reproducible: Always

Steps to Reproduce:
1. palette window -> choose palette -> import resource
2. selecting a css file made with gimp (exported palette)
3.

Actual Results:  
nothing happens

Expected Results:  
palette should load
Comment 1 Halla Rempt 2016-08-22 21:13:56 UTC
Krita only loads gpl, riff, aco and act palettes. Krita has never supported loading css files as palettes -- so this isn't a bug, but a feature request. In any case, just save your palette as gpl, and you can load it in Krita.

(Also, Ubuntu's 2.9.7 is very old, we're at 3.0 now.)
Comment 2 Philippe Lhoste 2018-03-26 08:51:26 UTC
Now that Krita 4 is out, it sounds like a good candidate for a Python script. Should be easy to do, I guess.
Comment 3 Tiar 2020-04-07 13:51:09 UTC
It can be inside Krita's code if it's important for Krita to have it, or if someone declares to maintain it (fix bugs if some comes up in later years).
Comment 4 Sean Castillo 2023-11-07 04:40:42 UTC
I got working on this. I have the most basic implementation working (4 RGB swatches and using the file name as the palette name), and I'll make sure it works with anything that could come up before I submit it.
Comment 5 Halla Rempt 2024-07-05 08:25:26 UTC
Git commit 67452db8bd9d5286bca14873c16bd84fcbd804a2 by Halla Rempt, on behalf of Thomas K/BIDI.
Committed on 05/07/2024 at 07:51.
Pushed by rempt into branch 'master'.

Implement CSS Palette support

Add the possibility to import CSS palette in Krita, in the same way
as the .gpl ones. Those palettes can be generated by GIMP or created
by the user, but the only property considered is "color".

The following color format is supported (based on their CSS syntax) :
    - rgb
    - rbga
    - hsl
    - hsla
    - hexadecimal

The file's suffix must be ".css".
If there is an error in the syntax or the color definition, errors
will be raised and the palette loading aborted.

M  +1    -1    libs/koplugin/KisMimeDatabase.cpp
M  +163  -0    libs/pigment/resources/KoColorSet.cpp
M  +2    -1    libs/pigment/resources/KoColorSet.h
M  +1    -0    libs/pigment/resources/KoColorSet_p.h

https://invent.kde.org/graphics/krita/-/commit/67452db8bd9d5286bca14873c16bd84fcbd804a2