Jump to content

Recommended Posts

Posted

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
Posted

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
Posted

@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
Posted

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...