Home > database >  Programmatically determine the html background color
Programmatically determine the html background color

Time:11-15

Is there a way to determine the background color used in the html, from inside an angular component? I am writing an angular component that's inside one of the many feature modules used where I need to know the background color used by the page, and I would like to determine dynamically the background color utilized. The webpage has multiple tabs, and this component can appear in any tab

CodePudding user response:

try this:

getComputedStyle(document?.querySelector?.("body") as Element).backgroundColor
  • Related