Hollands Spoor

The Notebooks

  • Asanoha, seigaiha and more.

    Asanoha, seigaiha and more.

    I needed backgrounds with wallpaper patterns that you can seamlessly place next to each other, like these for example:

    There are plenty of examples to be found if you search for something like ‘seamless pattern images’. If the license allows it, you can use them as a background for, for example, a Gutenberg Group block or Cover block. (In the settings dialogs for the background of these blocks, you can specify that the image should not be stretched but tiled next to each other, resulting in corresponding CSS background-size and background-repeat rules).

    You might want to customize these kinds of patterns to your own taste: color, line thickness, shape, size of the repeated base element, etc. Of course, you can also draw/create something yourself in, for example, Illustrator or Inkscape (the latter is preferred due to the views on intellectual property that Adobe imposes on its users). There are also online generators available that produce these kinds of patterns (add the words ‘online generator’ when searching).

    In any case, it would be better if you had this functionality within the WordPress block editor. Then you wouldn’t have to keep switching between the generator and WordPress, and you wouldn’t have to keep downloading and uploading patterns (and possibly exporting them to a usable format). This would also serve users who find all of this too cumbersome when they need new or customized patterns.

    What is really desirable, then, is such an online SVG pattern generator, but as part of the Gutenberg editor. To achieve this, I went through several steps, starting with the background pattern below:

    With this pattern in mind, I went through the following eight steps:

    1. Creating the SVG
    2. Creating JSON
    3. Passing JSON to the block editor
    4. Adding Functions that work with parameters
    5. Adding Inspector Controls to the Block Editor
    6. Creating a Renderer for Template, Parameters, and Function Results
    7. Presets
    8. Insert the SVG as a block background image

    Finally, I created some additional patterns with different presets for the parameters. At the end, there is an overview of these.

    Patterns and Presets

    Asanoha

    Dark Night

    Black River

    Star Blazer

    Soup

    Beach

    Red

    Blue

    Gump

    Free

    Crates

    Metalic

    Anatomy

    Fragile

    Ant

    Diamond

    Cardinal

    Leaves

    Polka

    Candy

    Rings

    Elegant

    Horrible 70

    Awefull 80

    Store

    Seigaiha

    Pink

    Pink Gradiënt

    Lime

    Classic 2