Reputation: 2658
How do you access the value of the CSS property --chrome-background-color
that is set on #titlebar
of the Firefox chrome in an addon from javascript?
I tried the variants:
document.getElementById( 'titlebar' ).style.backgroundColor // undefined
document.getElementById( 'titlebar' ).style['--chrome-background-color] // undefined
Upvotes: 1
Views: 252
Reputation: 2658
This worked:
window.getComputedStyle( document.getElementById('titlebar') ).getPropertyValue( '--chrome-background-color' )
From: Get a CSS value with JavaScript
Lesson: don't be hasty + it works for mozilla specific chrome elements.
Upvotes: 2