Report templatesFunctions

cellBackground

Apply conditional cell background color based on value matching

Usage

The cellBackground function returns a cell background color style when the input matches a target value.

Syntax

{input | cellBackground:target:color}

Parameters

  • input (any): The value to check
  • target (any): The value to match against
  • color (string): Hex color code to apply if values match

Returns

  • An object with cellBackground property if input matches target
  • null if values don't match or any parameter is null

Examples

Basic color application

{"Active" | cellBackground:"Active":"#00ff00"}
// Returns: { cellBackground: "#00ff00" }

Non-matching values

{"Inactive" | cellBackground:"Active":"#00ff00"}
// Returns: null

Status indicators

{project.status | cellBackground:"Complete":"#28a745"}
// Applies green background if project is complete

Number matching

{score | cellBackground:100:"#ffd700"}
// Gold background for perfect scores

Risk level coloring

{finding.priority | cellBackground:"P1":"#ff0000"}
// Red background for P1 priority findings

Use Cases

  • Conditional formatting in report tables
  • Status-based cell highlighting
  • Performance indicator coloring
  • Priority-based visual cues
  • Dynamic table styling based on data values