hvlads / django-ckeditor-5

Django CKEditor 5 integration.
Other
155 stars 60 forks source link

Ask me how to change the theme or background color. #145

Closed frame-fF closed 1 year ago

frame-fF commented 1 year ago

How do I change the theme or background color?

hvlads commented 1 year ago
  1. Create a CSS file named custom.css and place it in your project's static files directory. The location could be something like static/css/custom.css.

  2. Open the custom.css file in a text editor.

  3. Add your custom CSS rules to modify the desired styles. For example, to change the background color, you can use the following CSS rule:

    .ck-content {
       background-color: ...;
    }

    Replace ... with the desired background color value.

  4. Save the custom.css file.

  5. Update your settings.py file with the correct path to the custom.css file:

    CKEDITOR_5_CUSTOM_CSS = "css/custom.css"

    Note: Adjust the file path according to the location of the custom.css file relative to your static files directory.

  6. Save the changes in settings.py.

Ensure that your Django project is configured to serve static files correctly, and that the CKEDITOR_5_CUSTOM_CSS path matches the actual location of the custom.css file.

After making these changes, the CKEditor instances in your Django project should apply the styles defined in the custom.css file, including the desired background color modifications.