You are reading the development docs (2026.12.1-dev.1): features here may not be released yet.
Skip to content

Filters ​

Filters change how a whole card looks: blur it, brighten it, take the colour out, tint it, give it a shadow or warp it. Stack several in a list to combine them.

  • filters works on the button and elbow cards, and on the data grid with CSS filters only. The MSD card has the same filters for its blueprint as base_svg.filters (Base SVG Filters).
  • There are two kinds: the browser's CSS filters, which most looks need, and SVG filter primitives for what CSS can't do, such as a real colour tint or a distortion.

filters ​

filters is a list of filters applied to the card, one after another. Each entry names a type and gives its value; SVG filters also need mode: svg.

  • The CSS filters run first, in list order, then the SVG filters, chained in list order. Where you put an SVG entry among the CSS ones makes no difference.
  • On the button and elbow the filters apply to the card's drawing (its SVG), so the shape, its text and its icon change together.
  • An SVG type written without mode: svg is read as a CSS filter, which doesn't exist, so it is skipped (with a warning in the browser console).
yaml
type: custom:lcards-button
entity: light.living_room
preset: lozenge
text:
  name:
    show: true
# softened and brighter
filters:
  - type: blur
    value: 1px
  - type: brightness
    value: 1.3
More about filters
  • Live values: filter values are fixed; templates and entity bindings don't work in them.
  • Data grid: the grid takes CSS filters only. SVG filters need an SVG to attach to, so the grid skips them and logs a warning.
KeyTypeDefaultDescription
filterslist-The filters, applied in order
filters[].typestringrequiredThe filter: one of the CSS filters or SVG filters
filters[].valuenumber / string / objectper typeA number or string for a CSS filter, an object of value keys for an SVG filter
filters[].modestringcsscss or svg. Set svg for the SVG filters

CSS Filters ​

The browser's own CSS filters: blur, brighten, change the contrast or saturation, shift the hues, fade or turn the card grey. Leave out mode (or write mode: css); most take one number as value.

  • blur takes a length and hue-rotate an angle, as strings with their unit ("4px", "90deg").
  • Every CSS entry needs a valid value. One without a value, or a blur without px, makes the browser drop the CSS filters of the whole list, not just that entry.
  • Each filter has a playground under the example: move the sliders to see it on a sample shape, and copy the YAML it prints.
yaml
type: custom:lcards-button
entity: light.living_room
preset: lozenge
text:
  name:
    show: true
# faded colours, a little darker, slightly soft
filters:
  - type: saturate
    value: 0.4
  - type: brightness
    value: 0.85
  - type: blur
    value: 1px
Try each CSS filter

The playgrounds run the real filter code on a sample shape.

blur

Loading live preview…

brightness

Loading live preview…

contrast

Loading live preview…

saturate

Loading live preview…

hue-rotate

Loading live preview…

grayscale

Loading live preview…

sepia

Loading live preview…

invert

Loading live preview…

opacity

Loading live preview…

drop-shadow

Loading live preview…

typevalueExampleEffect
blurstring, px"4px"Gaussian blur; "0px" is none
brightnessnumber1.40 is black, 1 unchanged, above 1 brighter
contrastnumber1.20 is grey, 1 unchanged, above 1 more contrast
saturatenumber0.50 is grey, 1 unchanged, above 1 stronger colour
hue-rotatestring, deg"90deg"Turns every hue round the colour wheel; "0deg" is none
grayscalenumber, 0 to 111 is fully grey, 0 none
sepianumber, 0 to 10.61 is full sepia, 0 none
invertnumber, 0 to 111 inverts the colours fully, 0 none
opacitynumber, 0 to 10.5How see-through the card is; 1 is solid. For a see-through background only, use the background colour's alpha (style.card.color.background)
drop-shadowobjectsee belowA shadow outside the shape

drop-shadow ​

A shadow behind the card's shape, for depth or a glow. The shadow follows the drawn shape, not the card's box.

  • x and y are numbers in px; blur is a length string such as "6px".
  • The colour goes straight into CSS, so var(--lcars-*) variables and CSS colours work, but theme: tokens and alpha() don't.
yaml
type: custom:lcards-button
entity: light.living_room
preset: lozenge
text:
  name:
    show: true
filters:
  - type: drop-shadow
    value:
      x: 2
      "y": 2
      blur: 6px
      color: var(--lcars-orange)
More about drop-shadow
  • Short form: value can also be the CSS shadow as one string, such as "2px 2px 6px black". The card reads it, but the config checker and the editor expect the object.
KeyTypeDefaultDescription
value.xnumber0Offset to the right, px (negative is left)
value.ynumber0Offset down, px (negative is up)
value.blurstring0pxBlur radius, such as "6px"
value.colorcolourblackShadow colour: a CSS colour or var(--lcars-*)

SVG Filters ​

SVG filter primitives, for effects the CSS filters can't give: a real colour tint, colour matrices, glows, outlines and distortion. Each entry needs mode: svg, and its value is an object of value keys.

  • They chain: each primitive works on the result of the one before it in the list, so a blur followed by a blend makes a glow.
  • tint is the friendly one: a single entry for a colour wash. The others are the browser's SVG primitives, named as in SVG (feGaussianBlur ...).
  • The filter area reaches half the card's size past each edge, so a glow, shadow or warp has room outside the shape.
yaml
type: custom:lcards-button
entity: light.living_room
preset: lozenge
text:
  name:
    show: true
# a soft glow: blur the card, then blend the blur back over it
filters:
  - mode: svg
    type: feGaussianBlur
    value:
      stdDeviation: 4
  - mode: svg
    type: feBlend
    value:
      mode: screen
Try each SVG filter

The playgrounds run the real filter code on a sample shape.

feGaussianBlur

Loading live preview…

feColorMatrix

Loading live preview…

feOffset

Loading live preview…

feBlend

Loading live preview…

feComposite

Loading live preview…

feMorphology

Loading live preview…

feTurbulence

Loading live preview…

feDisplacementMap

Loading live preview…

On its own feDisplacementMap has nothing to warp by, so this playground may look unchanged. Chain it after feTurbulence in a real config to see the distortion.

tint

Loading live preview…

typeValue keysEffect
feGaussianBlurstdDeviationGaussian blur that chains with the other SVG filters; smoother than the CSS blur
feColorMatrixtype, valuesColour changes: saturation, hue turn, luminance to alpha or a custom matrix
feOffsetdx, dyShifts the result; with a blur, makes a shadow
feBlendmode, in2Blends the result with the card (or another input) in a CSS blend mode
feCompositeoperator, k1 to k4, in2Combines the result with the card (or another input)
feMorphologyoperator, radiusThins (erode) or thickens (dilate) the shapes
feTurbulencetype, baseFrequency, numOctaves, seedMakes a noise texture, usually for feDisplacementMap
feDisplacementMapscale, xChannelSelector, yChannelSelector, in, in2Warps the card by the colours of the result before it
tintcolorA flat colour wash over the card, such as an alert tint

SVG Value Keys ​

The keys each SVG filter takes in its value; a key you leave out takes the default in the table. Inputs name what a primitive works on: SourceGraphic (the card as drawn), SourceAlpha (its shape only), or the result of the primitive before.

  • feBlend and feComposite combine the previous result (on top) with in2, which is the card itself unless you set it.
  • feDisplacementMap warps in (the card) by in2 (the previous result, such as feTurbulence noise). feTurbulence makes new content and ignores what came before it.
  • tint starts from a flat colour and lays it over the card, so SVG filters listed before a tint have no effect. Its wash covers the whole filter area, background included, not only the shape.
yaml
type: custom:lcards-button
entity: light.living_room
preset: lozenge
text:
  name:
    show: true
# noise, then warp the card by it
filters:
  - mode: svg
    type: feTurbulence
    value:
      baseFrequency: 0.04
      numOctaves: 2
      seed: 5
  - mode: svg
    type: feDisplacementMap
    value:
      scale: 8
      xChannelSelector: R
      yChannelSelector: G
More about the SVG value keys
  • Colour matrix values: with type: saturate, values is a multiplier (0 grey, 1 unchanged); with type: hueRotate, an angle in degrees; with type: matrix, 20 numbers (a 4x5 matrix) as a list or a space-separated string. luminanceToAlpha takes no values.
  • Arithmetic composite: with operator: arithmetic, the result is k1*i1*i2 + k2*i1 + k3*i2 + k4, where i1 is the previous result and i2 is in2.
  • Tint colour: tint's color takes any LCARdS colour, theme: tokens and alpha() included; its alpha sets how much of the card shows through.
KeyTypeDefaultDescription
stdDeviationnumber0feGaussianBlur: amount of blur
typestringsaturatefeColorMatrix: saturate, hueRotate, luminanceToAlpha or matrix
valuesnumber / string / list1 saturate, 0 hueRotatefeColorMatrix: meaning depends on type; see the details above
dxnumber0feOffset: shift right, px (negative is left)
dynumber0feOffset: shift down, px (negative is up)
modestringnormalfeBlend: normal, multiply, screen, darken, lighten, overlay, color-dodge, color-burn, hard-light, soft-light, difference, exclusion, hue, saturation, color or luminosity
operatorstringoverfeComposite: over, in, out, atop, xor or arithmetic
k1number0feComposite: arithmetic coefficient, only with operator: arithmetic
k2number0feComposite: arithmetic coefficient, only with operator: arithmetic
k3number0feComposite: arithmetic coefficient, only with operator: arithmetic
k4number0feComposite: arithmetic coefficient, only with operator: arithmetic
in2stringSourceGraphicfeBlend, feComposite: the second input
operatorstringerodefeMorphology: erode (thinner) or dilate (thicker)
radiusnumber1feMorphology: how far to thin or thicken
typestringturbulencefeTurbulence: turbulence (cloudy) or fractalNoise (softer)
baseFrequencynumber0.05feTurbulence: 0 to 1; lower is larger features
numOctavesinteger1feTurbulence: 1 to 10 layers of detail
seednumber0feTurbulence: change it for a different pattern
scalenumber10feDisplacementMap: how strong the distortion is
xChannelSelectorstringRfeDisplacementMap: the channel that moves pixels across: R, G, B or A
yChannelSelectorstringGfeDisplacementMap: the channel that moves pixels up and down
instringSourceGraphicfeDisplacementMap: the image it warps
in2stringthe previous resultfeDisplacementMap: the map it warps by
colorcolourrgba(0,0,0,0.5)tint: the wash colour, with its alpha

Mixing CSS and SVG Filters ​

CSS and SVG filters can share one list. The CSS filters are applied first, in their order, then the SVG filters as one chain, whatever order the entries are in.

yaml
type: custom:lcards-button
entity: light.living_room
preset: lozenge
text:
  name:
    show: true
filters:
  # CSS
  - type: brightness
    value: 1.2
  # SVG
  - mode: svg
    type: feColorMatrix
    value:
      type: saturate
      values: 0.6
  • Base SVG Filters: the same filters on an MSD card's blueprint, with recipes and rules that change them on a condition
  • Animations: animate a card over time; the pulse preset animates a brightness filter
  • Styles: card background and border styles
  • Background Animations: canvas-based animated backgrounds (separate from filters)

Released under the MIT License. | About