Color Themes - 图1

Color Themes

Framework7 comes with 9 ready to use default color themes. Note that colors a bit vary for iOS and MD themes to match official guide lines.

ColoriOSMD
red
#ff3b30
#f44336
green
#4cd964
#4caf50
blue
#007aff
#2196f3
pink
#e91e63
#e91e63
yellow
#ffcc00
#ffeb3b
orange
#ff9500
#ff9800
gray
#8e8e93
#9e9e9e
white
#fff
#fff
black
#000
#000

Apply Color Themes

It is easy to apply color themes. All you need is just to add color-theme-[color] class to the required parent element. It could be body, app root, view, page, navbar, toolbar, list-block, etc. For example:

  1. <body class="color-theme-red">
  2. ...
  3. </body>
  4. <div class="page color-theme-green">
  5. ...
  6. </div>
  7. <div class="list-block color-theme-pink">
  8. ...
  9. </div>
  10. <div class="navbar color-theme-orange">
  11. ...
  12. </div>
  13. <div class="segmented color-theme-yellow">
  14. ...
  15. </div>

Note, that applied color theme affects only interractive elements such as links, buttons, form elements, icons. It doesn’t change basic text color or background colors on other blocks.

Layout Themes

Framework7 also has additional dark theme layout. To apply dark theme we need to add theme-dark class to the required parent element. It could be body, app root, view, page, navbar, toolbar, list-block, etc. For example:

  1. <body class="theme-dark">
  2. ...
  3. </body>
  4. <div class="page theme-dark">
  5. ...
  6. </div>
  7. <div class="list-block theme-dark">
  8. ...
  9. </div>

Helper Classes

There are also additional helper classes that could be used without/outside color themes:

  • **color-[color]** - if you want to change color of individual button, link or icon, for example:

    1. <a class="button color-red">Red button</a>
  • **text-color-[color]** - if you want to change text color of required element:

    1. <p class="text-color-red">Red color text</p>
  • **bg-color-[color]** - if you want quickly to set predefined background color on some block or element:

    1. <span class="badge bg-color-pink">14</span> - pink badge
  • **border-color-[color]** - if you want to set predefined border color:

    1. <div class="button border-color-red">...</div>

And of course, you can mix these helper classes:

  1. <div class="navbar bg-color-blue text-color-white border-color-gray">...</div>