移动端安卓和IOS开发框架Framework7教程-Color Themes

iOS Theme Colors

实例预览

Framework7 comes with 10 ready to use default iOS color themes. But first of all, you need to include additional stylesheet to be able to use all these color themes:

  1. <head>
  2.     ...
  3.     <link rel="stylesheet" href="path/to/framework7.ios.min.css">
  4.     <!-- It should be included After main Framework7 styles -->
  5.     <link rel="stylesheet" href="path/to/framework7.ios.colors.min.css">
  6. </head>
复制

 

gray   #8e8e93
white   #ffffff
black   #000000
lightblue   #5ac8fa
yellow   #ffcc00
orange   #ff9500
pink   #ff2d55
blue (default)   #007aff
green   #4cd964
red   #ff3b30

Material Theme Colors

实例预览

Framework7 comes with 22 ready to use default Material color themes. And also, you need to include additional stylesheet to be able to use all these color themes:

  1. <head>
  2.     ...
  3.     <link rel="stylesheet" href="path/to/framework7.material.min.css">
  4.     <!-- It should be included After main Framework7 styles -->
  5.     <link rel="stylesheet" href="path/to/framework7.material.colors.min.css">
  6. </head>
复制

 

red   #f44336
pink   #e91e63
purple   #9c27b0
deeppurple   #673ab7
indigo   #3f51b5
blue (default)   #2196f3
lightblue   #03a9f4
cyan   #00bcd4
teal   #009688
green   #4caf50
lightgreen   #8bc34a
lime   #cddc39
yellow   #ffeb3b
amber   #ffc107
orange   #ff9800
deeporange   #ff5722
brown   #795548
gray   #9e9e9e
bluegray   #607d8b
white   #ffffff
black   #000000
 

Apply Color Themes

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

  1. <body class="theme-red">
  2.     ...
  3. </body>
  4.  
  5. <div class="page theme-green">
  6.     ...
  7. </div>
  8.  
  9. <div class="list-block theme-pink">
  10.     ...
  11. </div>
  12.  
  13. <div class="navbar theme-orange">
  14.     ...
  15. </div>
  16.  
  17. <div class="buttons-row theme-yellow">
  18.     ...
  19. </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 2 additional layout themes: "white" and "dark". To apply layout theme we need to add layout-[theme] class to the required parent element. It could be body, view, page, navbar, toolbar, list-block, etc. For example:

  1. <body class="layout-dark">
  2.     ...
  3. </body>
  4.  
  5. <div class="page layout-white">
  6.     ...
  7. </div>
  8.  
  9. <div class="list-block layout-dark">
  10.     ...
  11. </div>
复制

Helper Classes

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

  • color-[color] - if you want to change text color of required block, or change color of separate button, link or icon, for example:

    1. <a class="button color-red">Red button</a>
    2. <i class="icon icon-back color-red">
    复制
     
  • bg-[color] - if you want quickly to set predefined background color on some block or element:

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

    1. <div class="navbar border-white">...</div>
    复制
     

And of course, you can mix these helper classes:

  1. <div class="navbar bg-lightblue color-white border-gray">...</div>
复制

Note, that you can't use helper classes inside of container with theme classes. For example, this will have no effect:

  1. <div class="theme-red">
  2.     <a href="#" class="color-blue">Link will be red, not blue</a>
  3. </div>
复制

 

你可能感兴趣的:(Framework7)