Change page background colour when grammar changes


Good day,

Is it possible to change the background colour of the editor to suit the grammar displayed there? A mixin idea might look something like below -

@import "syntax-variables";

.theme() when (data-grammar = "") {
        background-color: black

.theme() when (default()) {
	background-color: @syntax-background-color

atom-text-editor {

The data-grammar = "" is the portion that needs something - in my opinion.

In advance my thanks.