I have declared sass variable in variable.scss like
$colors: (
primary: #488aff,
secondary: #32db64,
danger: #f53d3d,
light: #f4f4f4,
dark: #222,
white: white,
toolBarMain:black
);
now I want to use primary in my type script file home.ts .
How can i use it ?
1 Like
In general there is no easy or even reasonable way to do this - probably your design is not correct, describe what need to achieve, there probably is some other way than accessing scss variables from controllers.
One solution can be converting your scss file to JSON and loading this in some service, there is a tool:
https://www.npmjs.com/package/scss-to-json
I have to toggle the colour of text dynamically on click event . I want to define the colour in variable.scss .I can do it by [class.activeHIghlight]
and make it true or false as per my requirement and give css to activeHIghlight class . But i wanted it in another way .