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

Preset colours not showing in edit page #36

Open
billymedia opened this issue Aug 13, 2021 · 16 comments
Open

Preset colours not showing in edit page #36

billymedia opened this issue Aug 13, 2021 · 16 comments
Assignees
Labels
bug Something isn't working investigating

Comments

@billymedia
Copy link

As described in this thread: #32

When you create a colorit field with the colours preset, the colours dont appear when editing the entry.

I saw that you posted an update with a fix, but i am using Colorit 1.1.2.1 with Craft CMS 3.7.6
and its still showing the issue.

What can i do to fix this?

@proimage
Copy link

@ben-callaway I'm now getting this issue as well on a staging server, but not in my local version of the site.

@cdfwebsolutions
Copy link

The issue appears to be that the field outputs in the CP an extra '#' character before the hex code (e.g., ##336699 instead of #336699)

@proimage
Copy link

proimage commented Aug 24, 2021

I'm actually seeing them without any # symbol on my end.
image
I wonder if the setting to control the output format is affecting things in the backend.

@cdfwebsolutions
Copy link

cdfwebsolutions commented Aug 24, 2021

Hmmm ... I had to set the presets to output in 454545 (no # symbol) format to avoid getting double ## on the front-end, but I still get the double ## in the CP on Craft 3.6.11.2 with latest Colorit.

I thought I might have to do something like #{{ myColorField | slice(-6) }} everywhere I had a Colorit field, but it seems okay on the front-end with the 454545 format.

@proimage
Copy link

Yeah, something's definitely wonky.

@proimage
Copy link

proimage commented Sep 9, 2021

Can this get bumped up in priority, @ben-callaway or @samhibberd ?

@proimage
Copy link

proimage commented Sep 27, 2021

Possible fix: Edit and re-save any color presets you have.

EDIT: Note that you can even do this on live sites that have admin changes disabled... just navigate to yoursite.com/admin/colorit/presets manually.

@BallardB
Copy link

BallardB commented Nov 2, 2021

Bumping this post up because I am still seeing the issue. I've tried editing and re-saving presets but that did not fix the issue.

Would love to use this plugin on a production site for a client but this bug is really preventing us from using it at all.

Any updates on when this might be fixed?

@ben-callaway
Copy link
Contributor

Sorry @BallardB - will take another look!

@ben-callaway ben-callaway added the bug Something isn't working label Nov 3, 2021
@BallardB
Copy link

BallardB commented Nov 3, 2021

Thanks @ben-callaway I really appreciate it!

@proimage
Copy link

Any news on this?

@mcjackson18
Copy link

Hi @ben-callaway, is there any update on this?

Not fully tested this yet, as a quick fix changing line 26 in /templates/_fields/colorit/input.twig to the below is working for me

{% set processedColor = field.allowOpacity and opacity < 100 ? craft.colorit.colors.hexToRgba(paletteColor.color, opacity) : ('#' in paletteColor.color ? paletteColor.color : '#' ~ paletteColor.color) %}

@cmalven
Copy link

cmalven commented Dec 23, 2021

I'm experiencing the same issue, and this is preventing me from saving any changes to a matrix block, because all preset colors will be lost and break the site.

@taher-amici
Copy link

taher-amici commented Apr 26, 2022

Hi
For removed ## in frontend code
fields/coloritField.twig at getPalette() in 305

if (strpos($palette[$paletteColor['handle']]['color'], '#') !== false) {
    $palette[$paletteColor['handle']]['color'] = trim($palette[$paletteColor['handle']]['color'], '#');
}

@sgtpenguin
Copy link

sgtpenguin commented Oct 6, 2022

@ben-callaway I am experiencing this issue after updating to 3.0.0

Also, downgrading back to 1.0.9.3 now throws this error:
Screen Shot 2022-10-06 at 12 29 19 PM

@pascal-blaser
Copy link

Any updates? Just ran into the same issue again.

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

No branches or pull requests