I already know the excellent Kirby Colour Picker plugin, which gives us a neat colour picker field for our blueprints. This plugin, however, has a limitation: it only outputs colours in a single format: hex - ie., #aabbcc.
In my current project, I need the user to be able to pick a semi-transparent colour - ie., an rgba colour, like rgba(123,23,44,0.5). I’ve had a quick look, but cannot find a plugin that does that, nor a function in Kirby that might be able to convert hex colours to rgb (which would already do the trick).
There may be a colour picker plugin that does rgba, that I don’t know about. If this magical plugin exists, please point me in its direction!
Otherwise, I might have to try and find a short PHP function that can convert hex colours to rgb. In this case, I could add a second, separate field to get the user to specify the transparency of the colour, and then convert the 2 fields into an rgba value. Please, do let me know also if you know how to do this, or already have such a function handy!
The Color Picker plugin hasn’t seen some love in a while. Does anyone know whether it’s still being actively developed? Alternatively, is anyone able to say whether Kirby 3 perhaps will have a new color field built-in?
We need a color field that is compatible with the latest Kirby release, and that can support picking RGBA colours - i.e., colours with an opacity component. I could make these changes to the existing plugin, but don’t want to waste effort if the author is still updating it, or if K3 will come out with a buil-in solution of its own…
I wouldn’t say “actively” developed but if things break as new versions of Kirby are released, I’ve tried to keep it updated. Most recent updates have come from the community in the form of a pull request so if there are bug fixes or extended functionality you’d like to see added, I’m open to suggestions.
The Javascript component is based on the jQuery Minicolors plugin which does support RGBA however the Kirby field wasn’t implemented to take advantage of that functionality.
I’ve just made a pull-request to your repo, which reorganises the project folder in order to make installation compatible with the current version of Kirby.
I’ve had a look at the docs for the MiniColors jQuery Plugin, and it should not be difficult for us to add the RGBA functionality - I’ll be happy to add it for you, once my current pull-request is accepted.
Hi, @iancox, I’ve just sent you a big pull request which adds several features, including RGBA (“opacity”) functionality. Other features include the ability to select the type of colour picker, and being able to add pre-defined clickable colour swatches.
I came across several interface update issues, and eventually overcame them by following some advice from @bastianallgeier and refactoring the entire javascript as a jQuery field plugin. The new code is not minified, and fully commented - so it should be easy to update when new versions of Minicolors come out.
I updated the readme to reflect the changes in functionality, and also thought it might be a good idea to upgrade the version in the package.json to 1.3, so people are aware that there are new features. It should be backwards compatible with blueprints and templates using 1.2.
Please feel free to test everything - it is not thoroughly tested, but I found it stable enough for me to use it in a couple of my production sites already - and my users like it.
Sorry to bump this old thread but im just trying to use this plugin with 2.5.12 and it throws and error right off the bat. @iancox@luxlogica any idea whats wrong? Perhaps the name of the field it is extending has changed?
Fatal error: Class 'InputField' not found
Seems to be this line in the plugin causing it…
class ColorField extends InputField{
Edit: Sorry chaps… my bad. DIdn’t notice it had to go in the fields folder, not the plugin folder. It’s all good.