by default the ionic had provide the following color
$colors: (
primary: #EF5A28,
secondary: #f5911e,
danger: #f53d3d,
light: #f4f4f4,
dark: #222,
favorite: #69BB7B,
darkgraycustom: #333333,
mediumgraycustom:#666666,
lightgraycustom : #b2b2b2
);
this is easy for use when we are directly bind to DOM using color=“primary”, but if i want to use in my .scss file then how to i access the color in this list?
for example if i want my border to be the primary color? something like border:1px solid $color.primary?
I get “undefined variable”. Your suggestion is not complete. How to import the variables from the variables file? Do I have to import the variables file into every component?
Well, first of all try the way @rapropos suggested, i.e. instead of map-get() use color($colors, primary, base).
Next, check that a $color array is defined in your src/theme/variables.scss file. All these variables are imported automatically.
PS: In principle you can define CSS/SASS variables wherever you want or need them. But the idea behind the theme colors is that they are defined for all components of your app in this central variables.scss file.
Whenever I want to use my color variable inside a component scss file, I get undefined. Did not find anywhere how to import those variables or if Ionic or angular-cli or node-sass makes it for you.
The reason you may be getting the undefined is due to color: map-get($colors, primary); being placed in the scss file before the $colors property, thus the reason you are getting undefined. Place it after the $colors: (); block and it will no longer give you an error.
Anyhow, I find it logical that variables inside the theme and variables folders are loaded before the scss in the components. So I have no idea, why they would load differently.