Skip to content

Commit de90535

Browse files
committed
theming README
1 parent b01aee4 commit de90535

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

.io-config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"app_id":"5b5dc3a7","api_key":"1ce0dc5bb6e30b6d819a8489d8b6b7ccfc878c7137c79f06"}

ionic.config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Ionic2Components",
3-
"app_id": "",
3+
"app_id": "5b5dc3a7",
44
"v2": true,
55
"typescript": true
66
}

src/pages/theming/README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
## Theming your app
2+
3+
Many thanks to [Scott](https://github.com/ScottMBerger) for this feature!
4+
To do so, there are a few easy steps you'd have to follow:
5+
6+
### HTML
7+
To theme your app(sidemenu or tabs), wrap your whole app.html with a div like:
8+
9+
```html
10+
<div class="{{global.state['theme']}}">
11+
// app.html code...
12+
</div>
13+
```
14+
15+
### CSS
16+
After that, create your own theme files in `src/theme/`. [Take a look](https://github.com/yannbf/ionic2-components/blob/master/src/theme/dark.theme.scss) at one of the examples used in this repo.
17+
18+
Finally, you import your theme in `app.scss` adding one line as:
19+
```css
20+
@import '../theme/dark.theme';
21+
```
22+
23+
### Typescript
24+
Lastly, you need a way that you can dinamically set the theme class whenever you want to. In this repo, I used a [Global State Class](https://github.com/yannbf/ionic2-components/blob/master/src/app/app.global.ts) so I could set my variables in whichever page I want.
25+
26+
To do so, just add this to the class that will change the app's theme:
27+
```javascript
28+
constructor(public navCtrl: NavController, public global: AppState) { }
29+
changeTheme(theme) {
30+
this.global.set('theme', theme);
31+
}
32+
```
33+
34+
From there is just joy and happiness :tada: :tada:

0 commit comments

Comments
 (0)