marteinn / wagtail-color-panel

A package that adds new panels for selecting colors, works both on regular page fields and stream field.
MIT License
51 stars 9 forks source link

Default value for NativeColorBlock #7

Closed Eng-Ahmad-Almohammad closed 1 year ago

Eng-Ahmad-Almohammad commented 2 years ago

The default value for NativeColorBlock is not working for me and when I checked the source code I could not find it the default option, but in the documentation example you were using the default option.

marteinn commented 2 years ago

Hi @Eng-Ahmad-Almohammad, I just tested using NativeColorBlock with a custom default color and it worked (using Wagtail 3/Python 3.9/Django 4.0.4.

# ...
from wagtail_color_panel.blocks import NativeColorBlock

class ArticlePage(HeadlessPreviewMixin, BasePage):
    content = StreamField([
        ('color', NativeColorBlock(default="#FF0000")),
    ], null=True)

    content_panels = BasePage.content_panels + [
        FieldPanel("content"),
    ]

Could you provide more details on how you are using NativeColorBlock? Also please include your Wagtail, Django and Python version. Thanks!

marteinn commented 1 year ago

Hi @Eng-Ahmad-Almohammad, just wanted to follow up on this, are you still having issues? Thanks!

marteinn commented 1 year ago

I'm closing this since as I'm missing feedback.