Jump to content
verdeandrea

Gradient picker module

Recommended Posts

Hello everybody!

I am working on a project that should allow the user to generate a gradient from the admin panel. Something similar to the Photoshop gradient panel, or to this https://www.colorzilla.com/gradient-editor/

Is anyone aware of an existing module that is already doing that? The alternative is that I try to write my first (!) module!
Do you have any advice or suggestion on how I should approach this?

Thanks

 

  • Like 1

Share this post


Link to post
Share on other sites

There is this the fieldtype Color module and the ColorPicker module.

You could get you a copy of those, dig through the code to see how they have done it.
That's the way I would go in this case.

Afterwards I'd take an existing 3rd-party tool or library (GPL oder MIT license) and implement it somehow.

  • Like 5

Share this post


Link to post
Share on other sites

@verdeandrea Sounds like a cool project! If I had to do this, I guess I would go a similar route like @wbmnfktr suggests.

However, gradient generators are a lot more work than just (single) color-pickers. I'm not sure it's worth re-creating all that stuff just so your authors can finally insert some CSS for a given section.

I would perhaps rather use a markup inputfield*, and just open a gradient generator in a (pw-) modal, and instruct the editors to copy and paste the generated CSS into a regular textarea. Would certainly not look as polished and streamlined as a native PW inputfield, but it would get the job done way faster.

https://modules.processwire.com/modules/fieldtype-runtime-markup/ or https://processwire.com/talk/topic/21982-rockmarkup2-inputfield-to-easily-include-any-phphtmljscss-in-the-pw-admin/

 

  • Like 3

Share this post


Link to post
Share on other sites

Thanks @wbmnfktr and @dragan!

I was looking into it and it is acually way more complex than a single color picker.

It is challenging and I would like to give it a try but I think I would initially go with dragan suggestion. It sounds like a smart and fast solution!

Thanks!

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...