question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

v4: Allow customizing SCSS variables used in Ionic (or add more css variables)

See original GitHub issue

Feature Request

If I haven’t missed anything, Ionic v4 alpha only allows to override the css variables and not the scss variables used in the Ionic framework. This limits the customizability a lot.

Ionic Info Run ionic info from a terminal/cmd prompt and paste the output below.

cli packages: (/Users/andi/.nvm/versions/node/v8.11.1/lib/node_modules)

   @ionic/cli-utils  : 2.0.0-rc.6
   ionic (Ionic CLI) : 4.0.0-rc.6

local packages:

   @angular-devkit/core       : 0.6.0
   @angular-devkit/schematics : 0.6.0
   @angular/cli               : 6.0.7
   @ionic/schematics-angular  : 1.0.0-rc.6
   Ionic Framework            : @ionic/angular 4.0.0-alpha.7

System:

   NodeJS : v8.11.1
   npm    : 5.6.0
   OS     : macOS High Sierra

Describe the Feature Request Currently it doesn’t seem to be possible to change the SCSS variables used in Ionic 4. This is really bad for some of the enterprise apps I’m working on, because they require a custom corporate font and various other changes. The changes I need to make are not covered by the currently available css variables but would be easy to do with the Ionic SCSS variables.

In Ionic 1/2/3 this was easy to do by setting custom values to the variables in variables.scss. In Ionic 4 alpha this doesn’t seem to be possible without creating a custom build of the Ionic Framework.

I’m currently using some ugly css overrides to workaround this but I’d very much like to not do this.

Describe Preferred Solution Allow customizing all the scss variables

Describe Alternatives Make everything available as css variables

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:21 (7 by maintainers)

github_iconTop GitHub Comments

5reactions
brandyscarneycommented, Jun 18, 2018

Thanks for the issue! We are currently working on adding more css variables for customization on this branch: https://github.com/ionic-team/ionic/tree/core-css-variables

Once that is good to go we will merge it to master and create a new release.

4reactions
brandyscarneycommented, Aug 10, 2018

@MrSparklle It should be possible to change the font-family in latest using something like the following:

:root {
  --ion-font-family: "Comic Sans MS" !important;
}

or if you want to change it per mode:

.ios {
  --ion-font-family: "Comic Sans MS" !important;
}

.md {
  --ion-font-family: "Courier New" !important;
}

I’d like to remove the need for !important, but this should work for now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

CSS Custom Properties for Variables & Components
Ionic components are built with CSS Variables for easy custom app properties. They allow a value to be stored in one place, then...
Read more >
A Primer on CSS Variables/Custom Properties for Ionic
In this article, we are going to take a brief look at what CSS variables are and how we will be using them...
Read more >
Ionic 4 CSS Variables - Stack Overflow
I'm trying to use the variables defined on the variables.scss file, but remote debugging the app i see that no variable was defined...
Read more >
Ionic CSS Variables Dynamic Theme Generator - Fireship
One of the major changes to theming in Ionic 4 is the use of CSS variables, which are simply CSS values that can...
Read more >
Ionic 5|4 How to Change CSS Custom Properties of UI ...
These are actually the SCSS variables using which we can customize these. Changing Style of Ionic UI Web Component. Step 1) Add a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found