Gradient Colors

Warning

Gradient colors cannot be used for debug[color].

Detailed explanations and examples are shown for the supported types of gradients:

Gradients are implemented as aliases of color

Gradient specifications are implemented as aliased specification of the color attribute. So, one could specify a gradient using only the color attribute:

specifying a linear_gradient using the color attribute
color:
  start: { x: 50, y: 60 }
  end: { x: 150, y: 60 }
  preset: 48

However, this isn’t very readable. In the above example, there is very little to signify that we declared a linear gradient. This could also be confusing if a solid color is specified for a specific gradient:

specifying a solid color using the linear_gradient attribute
linear_gradient: white

Nonetheless, either form will work as long as the specified value(s) is valid (regardless of the attribute name).

social_cards = {
    "cards_layout_options": {
        "background_color": {
            "preset": "WideMatrix",  # (1)!
            "start": { "x": 30, "y": 30 },
            "end": { "x": 1170, "y": 600 },
        },
    },
}
  1. This uses one of the conveniently pre-defined Preset Gradients.

social_cards = {
    "cards_layout_options": {
        "background_color": {
            "preset": "WideMatrix",  # (1)!
            "center": { "x": 300, "y": 315 },
            "radius": 300,
        },
    },
}
  1. This uses one of the conveniently pre-defined Preset Gradients.

social_cards = {
    "cards_layout_options": {
        "background_color": {
            "preset": "WideMatrix",  # (1)!
            "center": { "x": 600, "y": 315 },
            "angle": 45,
        },
    },
}
  1. This uses one of the conveniently pre-defined Preset Gradients.

layers:
  - background:
      linear_gradient:
        preset: WideMatrix # (1)!
        start: { x: 30, y: 30 }
        end: { x: 1170, y: 600 }
  1. This uses one of the conveniently pre-defined Preset Gradients.

layers:
  - background:
      radial_gradient:
        preset: WideMatrix # (1)!
        center: { x: 300, y: 315 }
        radius: 300
  1. This uses one of the conveniently pre-defined Preset Gradients.

layers:
  - background:
      conical_gradient:
        preset: WideMatrix # (1)!
        center: { x: 600, y: 315 }
        angle: 45
  1. This uses one of the conveniently pre-defined Preset Gradients.