'Angular getComputedStyle from SCSS

i am trying to get the computed style from SCSS file but it returns an empty string. is there another way to get the getComputedStyle from SCSS ?

Angular Component:

ngOnInit(): void { 
 const elem = getComputedStyle(document.documentElement);
 const colorTest = elem.getPropertyValue('test').trim();
console.log(colorTest); //equal to '' instead of red Hex Code
}

SCSS File:

$test : red;

stackblitz



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source