← Back to CSS domain

CSS.getBackgroundColors

No description available.

Domain: CSS experimental

Parameters

NameTypeDescription
nodeIdDOM.NodeIdId of the node to get background colors for.

Returns

NameTypeDescription
backgroundColorsarrayThe range of background colors behind this element, if it contains any visible text. If no visible text is present, this will be undefined. In the case of a flat background color, this will consist of simply that color. In the case of a gradient, this will consist of each of the color stops. For anything more complicated, this will be an empty array. Images will be ignored (as if the image had failed to load).
computedFontSizestringThe computed font size for this node, as a CSS computed value string (e.g. '12px').
computedFontWeightstringThe computed font weight for this node, as a CSS computed value string (e.g. 'normal' or '100').

Example Request

{
  "id": 1,
  "method": "CSS.getBackgroundColors",
  "params": {
    "nodeId": 1
  }
}

Example Response

{
  "id": 1,
  "result": {
    "backgroundColors": [],
    "computedFontSize": "computedFontSize-value",
    "computedFontWeight": "computedFontWeight-value"
  }
}

Usage in Node.js

const result = await send('CSS.getBackgroundColors', {"nodeId": 1});
console.log(result);
// {"backgroundColors": [], "computedFontSize": "computedFontSize-value", "computedFontWeight": "computedFontWeight-value"}