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

Color field migration from RGBA #6784

Open
mynameisfreedom opened this issue Nov 9, 2024 · 5 comments
Open

Color field migration from RGBA #6784

mynameisfreedom opened this issue Nov 9, 2024 · 5 comments
Labels
needs: information ❓ Requires more information to proceed

Comments

@mynameisfreedom
Copy link

Hi team, as always your new features are great, and it is fantastic that the Color field is in the core.

Description

But I have one issue with migration from hananils/kirby-colors plugin to the new Color field. Migration to the Color field is smooth except for one thing: hananils/kirby-colors plugin used rgba color when alpha is set to true. So, at the moment it is not possible to migrate those to the Kirby Color field.

hananils/kirby-colors saved alpha: true fields in this format rgba(0,0,0,0.3) so when I migrate to new Color field there is an error for every field that used opacity. And because every Layout Builder section in my Layout Builder has a color opacity overlay option for the section background image, that field is used a lot. 🫣

Expected behavior

If you could either:

  • add a script to change rgba inputs into new rgb format (example: rgba(0,0,0,0.3) into rgb(0 0 0 /0.3)) on save
  • or add support for legacy rgba colors

hananils/kirby-colors still work, but I doubt that will be the case for too much longer.

Maybe this is a small thing, but it would help hundreds of websites migrate smoothly to the new Color field.

Thank you in advance. 🙏

@distantnative
Copy link
Member

I thought this would already work. Have you the alpha: true option set? https://getkirby.com/docs/reference/panel/fields/color#alpha

@mynameisfreedom
Copy link
Author

mynameisfreedom commented Nov 9, 2024

Yes, I have alpha: true option set but it still gives me an error during saving in the panel.

Maybe your script don't support rgba(0,0,0,0.3) but support rgba(0, 0, 0, 0.3). I will see to test this.

@mynameisfreedom
Copy link
Author

Hmm, now in my test everything went smoothly... It migrated the color properly. And a few hours ago it gave me an error on every try.

You can feely close this, I will go for further migration.

@mynameisfreedom
Copy link
Author

mynameisfreedom commented Nov 9, 2024

Ah, on further migration I do get an error. Please leave this open, I need to explore more on why this is happening

Screenshot 11-09-2024 15 03 42

@distantnative distantnative added the needs: information ❓ Requires more information to proceed label Nov 9, 2024
@mynameisfreedom
Copy link
Author

mynameisfreedom commented Nov 18, 2024

Sorry for the delay. I think I found what is making an error.

The new Kirby color field only supports one format at a time (hex or RGB or HSL), but old Kirby colors plugin supported all formats at once.

screenshot-localhost-2024 11 18-20_15_12

For the same field in the Layout section on one page admins often used hex colors if the color is not transparent and RGB if the color is transparent. In that case, Kirby's color field drops an error for a color format it doesn't support. So, to make the migration, the admin would need to go from field to field and manually change color to get the supported format.

I reverted to the old Kirby colors plugin fields all fields with alpha: true, for the time being.

Could you do something about this?
Can you make a new Kirby Color field, for example: although it has format: hex and the old field value is RGB, don't report error, but convert the RGB value to hex? Or just don't throw an error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs: information ❓ Requires more information to proceed
Projects
None yet
Development

No branches or pull requests

2 participants