Skip to main content
Version: v7

Themes

Ionic provides several global variables that are used throughout components to change the default theme of an entire application. Application Colors are useful to change the look of most of the Ionic components, and Stepped Colors are used as variations in some of the Ionic components.

Application Colors

The application colors are used in multiple places in Ionic. These are useful for easily creating dark themes or themes that match a brand.

It is important to note that the background and text color variables also require a rgb variable to be set in rgb format. See The Alpha Problem for an explanation of why the rgb property is also needed.

NameDescription
--ion-background-colorBackground color of the entire app
--ion-background-color-rgbBackground color of the entire app, rgb format
--ion-text-colorText color of the entire app
--ion-text-color-rgbText color of the entire app, rgb format
--ion-backdrop-colorColor of the Backdrop component
--ion-backdrop-opacityOpacity of the Backdrop component
--ion-overlay-background-colorBackground color of the overlays
--ion-border-colorBorder color
--ion-box-shadow-colorBox shadow color
--ion-tab-bar-backgroundBackground of the Tab Bar
--ion-tab-bar-background-focusedBackground of the focused Tab Bar
--ion-tab-bar-border-colorBorder color of the Tab Bar
--ion-tab-bar-colorColor of the Tab Bar
--ion-tab-bar-color-selectedColor of the selected Tab Button
--ion-toolbar-backgroundBackground of the Toolbar
--ion-toolbar-border-colorBorder color of the Toolbar
--ion-toolbar-colorColor of the components in the Toolbar
--ion-toolbar-segment-colorColor of the Segment Buttons in the Toolbar
--ion-toolbar-segment-color-checkedColor of the checked Segment Buttons in the Toolbar
--ion-toolbar-segment-backgroundBackground of the Segment Buttons in the Toolbar
--ion-toolbar-segment-background-checkedBackground of the Segment Buttons in the Toolbar
--ion-toolbar-segment-indicator-colorColor of the Segment Button indicator in the Toolbar
--ion-item-backgroundBackground of the Item
--ion-item-border-colorBorder color of the Item
--ion-item-colorColor of the components in the Item
--ion-placeholder-colorColor of the placeholder in Inputs

Stepped Colors

After exploring different ways to customize the Ionic theme, we found that we couldn't use just one background or text color. In order to imply importance and depth throughout the design, we need to use different shades of the background and text colors. To accommodate this pattern, we created stepped colors.

While updating the background (--ion-background-color) and text (--ion-text-color) variables will change the look of the app for most components, there are certain Ionic components where it may look off, or broken. This will be more apparent when applying a darker theme.

In some components we use a shade darker than the background or lighter than the text. For example, an item heading text may need to be

#404040
, which is a few shades lighter than our default text color. Meanwhile, the loading component background is a shade darker than white, using
#f2f2f2
. We use stepped colors in order to define these slight variations. It is important to update the stepped colors when updating the background or text color of an application.

By default, the Ionic stepped colors start at the default background color value

#ffffff
and mix with the text color value
#000000
using an increasing percentage. The full list of stepped colors is shown in the generator below.

Stepped Color Generator

Create a custom background and text color theme for your app. Update the background or text color’s hex values below, then copy and paste the generated code directly into your Ionic project.

Background

Text

:root {
	--ion-background-color: 
#ffffff
; --ion-background-color-rgb:
255,255,255
; --ion-text-color:
#000000
; --ion-text-color-rgb:
0,0,0
; --ion-color-step-50:
#f2f2f2
; --ion-color-step-100:
#e6e6e6
; --ion-color-step-150:
#d9d9d9
; --ion-color-step-200:
#cccccc
; --ion-color-step-250:
#bfbfbf
; --ion-color-step-300:
#b3b3b3
; --ion-color-step-350:
#a6a6a6
; --ion-color-step-400:
#999999
; --ion-color-step-450:
#8c8c8c
; --ion-color-step-500:
#808080
; --ion-color-step-550:
#737373
; --ion-color-step-600:
#666666
; --ion-color-step-650:
#595959
; --ion-color-step-700:
#4d4d4d
; --ion-color-step-750:
#404040
; --ion-color-step-800:
#333333
; --ion-color-step-850:
#262626
; --ion-color-step-900:
#191919
; --ion-color-step-950:
#0d0d0d
; }