Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Critical: Presets don't show correct colors, defaults to light grey #32

Closed
mattaebersold opened this issue May 11, 2021 · 18 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@mattaebersold
Copy link

  • Craft Pro 3.6.13
  • Colorit 1.0.9.3

Preset set, and showing colors in plugin settings:
image
image

Using a supertable field set to colorit, but here's the set of presets:
image

And furthermore, in the entry edit view
image

@iamtompickering
Copy link

@mattaebersold I've also just come across this issue. Bit of a strange one, because it is working as expected for some preset colours, but not for others...

Screenshot 2021-05-13 at 11 12 34

Looking in Dev Tools, the # is missing.

@hinderson
Copy link

I have the same issue. Seems like Craft has changed how they're storing hex values for the native color field (which this plugin uses) – they're now without the # prefix. It's only an issue for new fields or updated fields, so it took me a while to discover it.

I made a fork with a quick fix to make the preview's show, but it's very much a hack and I'm not sure of the larger consequences of using it like this. https://github.com/SPRNGSMMR/colorit/tree/bugfix

@chadcrowell
Copy link

chadcrowell commented Jun 3, 2021

Same issue here. It appears to me to be working fine within a Super Table but not within a Matrix. (or perhaps, that Super Table field hasn't been updated, but the Matrix one has, as @hinderson noted above)

@robzor
Copy link

robzor commented Jun 9, 2021

I've also got this issue, has anyone heard anything back from the devs?

@samhibberd
Copy link
Contributor

So sorry for the silence, we have literally just hit the launch button on what has been an all consuming 18 month project for our entire team, lucky that our partners are still talking to us all, let alone everyone else!

Anyway we should finally have some time to give our plugins some well overdue attention, please bear with us whilst we get our lives back on track!!!

Thanks.

S

@robzor
Copy link

robzor commented Jun 11, 2021

Hi @samhibberd thanks for getting back to me, I totally understand all consuming projects!

Can I please ask if you have any sort of ETA on a fix for this? I'm currently working on a client site and there really isn't a suitable alternative to your plugin that will work for them.

Just to clarify, this is what you see on a field. And if you choose any of the swatches, they do not output on the front-end either.

CleanShot 2021-06-11 at 11 56 24

@proimage
Copy link

Here's hoping it's a simple fix; it seems like it should be...

@david-garcia-jr
Copy link

Screen Shot 2021-06-23 at 10 30 15 AM

Looks like the hash is missing from all custom color presets.

@ben-callaway ben-callaway added the bug Something isn't working label Jun 23, 2021
@pelmered
Copy link

pelmered commented Jul 6, 2021

Any progress with this? We have had this problem in production for almost two months now.

It is a pretty critical bug and it should be a pretty simple fix as far as I can tell.

@david-garcia-jr
Copy link

Any progress with this? We have had this problem in production for almost two months now.

It is a pretty critical bug and it should be a pretty simple fix as far as I can tell.

Same here, we used this field type heavily in a recent production site and all colors were dropped from a large number of components. Unfortunately, we have had to revert to Crafts default color field.

@pelmered
Copy link

pelmered commented Jul 6, 2021

Yes, we will probably have to revert to the default as well. I don't feel like this plugin can be trusted anymore unfortunately.

@robzor
Copy link

robzor commented Jul 6, 2021

I've ended up having to use a Super Table with a combination of both a native Colour field and this: https://github.com/percipioglobal/craft-colour-swatches

Hopefully the guys will get some time to fix the bug soon though, as I prefer the UX of this plugin to the current client's needs.

@extensibleseth
Copy link

I had some luck using @hinderson's changes, and updating the regex in /helpers/ColorHelper.php isValidHex(). The leading # is optional now.

/^#[0-9a-f]{3}(?:[0-9a-f]{3})?$/i
to
/^#?[0-9a-f]{3}(?:[0-9a-f]{3})?$/i

@proimage
Copy link

Any progress on this, peeps? Seems like this would be low-hanging fruit, no? :-/

@ben-callaway
Copy link
Contributor

Fixed in 82872ca. Thanks for your patience everyone!

@sunscreem
Copy link

Hey @ben-callaway can I quickly check. I've just ran a batch updates which included 1.1.0 and 1.1.1.

In order to see things working again I needed to resave all entries using ./craft resave/entries and also find everywhere in the front end where I've output the hex code and add the missing #.. eg style="border-color: {{ block.colour }}" becomes style="border-color: #{{ block.colour }}".

Does that sound right?

@ben-callaway
Copy link
Contributor

@sunscreem I've just pushed an update (1.1.2.1) so the Auto (Best Guess) option now either outputs the HEX value including the hash or RGBa depending on the opacity value used. This means the default fieldtype twig can be used for all color options set in the CP. You can still choose to output with or without the # as required.

@proimage
Copy link

This is still a problem and really needs fixing, guys. See issue #36. 😠

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests