Request: Theme config item type ="colorpicker"??

Skinning and designing Serendipity (CSS, HTML, Smarty)
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Request: Theme config item type ="colorpicker"??

Post by Don Chambers »

So, in my latest thread about theme colorsets I was wondering how a theme designer could continue to make theme customization easier.

I think user selected images, colorsets and user stylesheets are awesome. But as that thread explores loading styles directly into serendipity.css, I cannot help but imagine how nice it would be to have a theme config type of "colorpicker" (or something like that) where a theme designer could provide a default value - hex and/or rgb (or rgba?!) and the user could change the value using a color picker. This could be great for background colors, link colors, hover, etc..... super easy and no user stylesheet needed.

Something like this:

Image

Thoughts? Anyone willing to take this on? :mrgreen:
=Don=
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: Request: Theme config item type ="colorpicker"??

Post by yellowled »

Don Chambers wrote:Thoughts?
You might not want to hear this.

Technically, this would be fairly easy and cheap. HTML brings input[type="color"] which is supposed to be a native color picker in the browser. Unfortunately, browser support is, well, incomplete at best (no IE, no Edge, no Safari).

The alternative is to use a jQuery/JS plugin color picker. There are a ton out there, and they all have one thing in common: they come with a lot of baggage. You need some JS, some CSS and often some image assets. Personally, I feel that this would be quite a lot to latch on to the lean and clean s9y backend just to be able to pick colors, especially since colorsets are not the norm in themes.

YL
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: Request: Theme config item type ="colorpicker"??

Post by Don Chambers »

I'm not seeing anything that I would describe as "a lot of baggage"... first one I went to was this: https://github.com/EastDesire/jscolor/releases - extremely lean IMHO. and I didn't even dig deep, or look into jQuery... there are probably other, even better scripts out there.

And as far as the current state of themes, and colorsets "not being the norm"... I was not trying to suggest that colorsets become the norm. Merely that having something like colorpicker might be one more easy to use tool for users when customizing themes. :wink:
=Don=
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: Request: Theme config item type ="colorpicker"??

Post by yellowled »

Don Chambers wrote:Merely that having something like colorpicker might be one more easy to use tool for users when customizing themes. :wink:
Yeah, that's the point where we don't agree. I don't see the point in making themes customizable in that way. I think it is way more satisfying to help the people that actually want to customize themes do that through the user.css than to give them more and more “fool-proof” interfaces. It's the whole “teach a man how to fish” thing.

My point is: if this is implemented (especially as part of the core) please pick a solution as lean as possible. There are other solutions out there that require a lot more assets than the one you mentioned.

YL
onli
Regular
Posts: 2825
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: Request: Theme config item type ="colorpicker"??

Post by onli »

Maybe input['color'] with a good description could already be enough? FF + Chrome should cover a lot of users, and the fallback in IE to a normal text input does not have to be horrible.

To add that would take ~5 lines of code.
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Request: Theme config item type ="colorpicker"??

Post by Timbalu »

yellowled wrote:... implemented (especially as part of the core) ...
HUH... Who said this :?:
IMHO a release zip delivered theme is not part of the core. It is just pre delivered because of license and easyness.
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: Request: Theme config item type ="colorpicker"??

Post by yellowled »

Timbalu wrote:IMHO a release zip delivered theme is not part of the core. It is just pre delivered because of license and easyness.
I assumed that for this to be available as a theme option for themes, it would have to be part of the core (like – as far as I know – all the other input types available as theme options).

YL
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: Request: Theme config item type ="colorpicker"??

Post by Don Chambers »

yellowled wrote: Yeah, that's the point where we don't agree. I don't see the point in making themes customizable in that way. I think it is way more satisfying to help the people that actually want to customize themes do that through the user.css than to give them more and more “fool-proof” interfaces. It's the whole “teach a man how to fish” thing.
There are FAR fewer serendipity users to teach to fish than there were several years ago. I think providing easy ways for people to customize themes is not a bad idea. We give them easy ways to add images, even though we could force them to go through user.css.

We have other theme option types, I was merely suggesting that we explore the idea of a colorpicker that would allow a theme designer to offer color input for theme options. Body colors, link colors, header colors, whatever. Just thought it might be a nice feature if it was implemented in - as you said - a lean way.[/quote]

Perhaps we can start with Onli's "5 lines of code" approach and see what develops from there. :wink:
=Don=
onli
Regular
Posts: 2825
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: Request: Theme config item type ="colorpicker"??

Post by onli »

I'll see now how easy that really is to do.
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: Request: Theme config item type ="colorpicker"??

Post by Don Chambers »

onli wrote:I'll see now how easy that really is to do.
I am happy to help in anyway I can.
=Don=
onli
Regular
Posts: 2825
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: Request: Theme config item type ="colorpicker"??

Post by onli »

I pushed it: https://github.com/s9y/Serendipity/comm ... 73b71b4723

Things left to do:
1. Make the button smaller (I did not want to mess too much with the css)
2. Test whether it works for you
3. Decide whether that needs a polyfill for IE, and if yes, add it

Also, given that this comes form colorsets, maybe it would be nice to combine that with a widget in which there are multiple colored squares, each defined by the theme author, to give a set of predefined colors to the colorpicker?

Ah, I forgot to show my example syntax:

Code: Select all

    array(
      'var'           => 'infotwokcolor',
      'name'          => 'infotwokcolor',
      'type'          => 'color',
      'default'        => '#AAEEFF',
    ),
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Request: Theme config item type ="colorpicker"??

Post by Timbalu »

Must this really be in core? Isn't this possible as part of the theme only...?
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
onli
Regular
Posts: 2825
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: Request: Theme config item type ="colorpicker"??

Post by onli »

No. You need to have this in the core, this goes through serendipity_plugin_config, and reads the tpl plugin_config_item from the admin theme. Besides, it is good to have it.

The only thing we could change is to make it dynamically, to have a config item which is just a html5 input, and where the input type is changeable by plugin/theme. But this collides with how it was done till now, and some of our widgets are more complicated than that.
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: Request: Theme config item type ="colorpicker"??

Post by Don Chambers »

Pretty cool - and just a few lines of code....

Here is what this looks like in 4 browsers on my Windows pc:

Image

As expected, it doesn't work in IE... which, unfortunately, a lot of the world uses (even if a lot of s9y users don't).

I am also wondering how do we make a choice of "none"?
=Don=
onli
Regular
Posts: 2825
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: Request: Theme config item type ="colorpicker"??

Post by onli »

Do we really need none? I mean, if it does not toggle new elements, those elements are there and have a color already. I rather think we'de need a way to set the default (maybe you meant that).

It always could be deactivable in a prior setting, but I don't like that.
Post Reply