You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ValoThemeGettingStarted.asciidoc 7.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. ---
  2. title: Valo Theme Getting Started
  3. order: 57
  4. layout: page
  5. ---
  6. [[valo-theme-getting-started]]
  7. Valo theme - Getting started
  8. ----------------------------
  9. To create your own variation of the Valo theme, start by creating a new
  10. custom theme for your project. See
  11. the link:CreatingAThemeUsingSass.asciidoc[Creating a theme using Sass] 
  12. tutorial to get that done.
  13. Change your theme import and include from Reindeer to Valo:
  14. [source,scss]
  15. ....
  16. @import "../valo/valo";
  17. .my-theme {
  18. @include valo;
  19. }
  20. ....
  21. To modify the theme outlook, define any of the global Sass variables
  22. before the import statement:
  23. [source,scss]
  24. ....
  25. $v-background-color: #777;
  26. @import "../valo/valo";
  27. ...
  28. ....
  29. See below for possible variables that you can adjust. There are also
  30. component specific variables, but those are not yet documented anywhere
  31. (at the time of writing). See the corresponding component Sass source
  32. files in the Vaadin Git repo, they are documented at the top of the
  33. files.
  34. [[main-global-variables-in-valo]]
  35. Main global variables in Valo
  36. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  37. * *$v-background-color*
  38. ** The main color of the theme, which is used for computing all other
  39. colors in the theme (you can override those computed defaults). Can be
  40. any CSS color value.
  41. * *$v-app-background-color*
  42. ** The background color of the application (think of the BODY element).
  43. Used for calculating some other component background colors. Can be any
  44. CSS color value.
  45. * *$v-app-loading-text*
  46. ** A static text which is shown under the initial loading spinner when
  47. the application assets are loaded by the browser. The default is an
  48. empty string. Provide any other value using quotes, e.g. +
  49. `$v-app-loading-text: "Loading Resources...";` +
  50. * *$v-line-height*
  51. ** The base line-height for all text in the theme. Should be specified
  52. as a unitless number, e.g. +
  53. `$v-line-height: 1.6;` +
  54. * *$v-font-size*
  55. ** The base font size for all text in the theme. Should be specified as
  56. a pixel integer value, e.g. +
  57. `$v-font-size: 18px;`
  58. * *$v-font-weight*
  59. ** The base font weight for all text in the theme. Should be specified
  60. as numeric value, e.g. +
  61. `$v-font-weight: 400;`
  62. * *$v-font-color*
  63. ** The base font color for all text in the theme. Can be any CSS color
  64. value. Computed by default.
  65. * *$v-font-family*
  66. ** The base font family for all text in the theme. The theme comes
  67. bundled with a few web fonts that you can easily use: Open Sans
  68. (default), Roboto, Lato, Lora and Source Sans Pro. Just specifying any
  69. of them in the $v-font-family will load the necessary font files also,
  70. e.g. +
  71. `$v-font-family: "Source Sans Pro", sans-serif;` +
  72. * *$v-unit-size*****
  73. ** The base sizing unit for various measures in the theme. The unit-size
  74. is for instance directly mapped to the height of the buttons, as well as
  75. to the layout margins. Must be specified as integer pixel value, e.g. +
  76. `$v-unit-size: 40px;`
  77. * *$v-layout-margin-top,  +
  78. $v-layout-margin-right,  +
  79. $v-layout-margin-bottom,  +
  80. $v-layout-margin-left*
  81. ** The margin size for all built-in layouts. Can be any CSS width
  82. value. +
  83. * *$v-layout-spacing-vertical,  +
  84. $v-layout-spacing-horizontal*
  85. ** The spacing size for all built-in layouts. Can be any CSS width
  86. value.
  87. * *$v-border*
  88. ** The base border definition for all components (though not all
  89. components have a border). Must be a valid CSS border shorthand, e.g. +
  90. `$v-border: 2px solid #ddd;`
  91. ** The color can be defined as a special keyword for Valo (v-tint,
  92. v-shade or v-tone). See the section about color keywords for details.
  93. * *$v-border-radius*
  94. ** The base border radius for all components. Must be specified as a
  95. pixel integer value, e.g. +
  96. `$v-border-radius: 8px;`
  97. * *$v-gradient*
  98. ** The gradient style for all components. This is not a CSS gradient,
  99. but a Valo specific syntax for specifying the gradient type and the
  100. gradient opacity, e.g. +
  101. `$v-gradient: v-linear 20%;`
  102. ** Only two gradient types are supported (at the time of writing):
  103. `v-linear` and `v-linear-reverse`
  104. ** The opacity must be specified as a percentage value from 0% to 100%.
  105. * *$v-bevel*
  106. ** The bevel style for all components. The bevel defines how the
  107. components "lift-up" from the background of the application, as a sort
  108. of a 3D effect. The syntax is the same as for CSS box-shadow, but only
  109. inset shadows should be used. You can define as many bevels
  110. (box-shadows) as you wish. E.g. `$v-bevel: inset 0 2px 2px 0 #fff, inset
  111. 0 -2px 2px 0 #ddd;`
  112. ** You can also use the color keywords (v-tint, v-shade, v-tone: see
  113. below) in place of the colors to make the bevel adapt to any color to
  114. which it is applied to (e.g. different colored buttons).
  115. * *$v-bevel-depth*
  116. ** The "depth" of the bevel effect, i.e. how evident the bevel effect
  117. is, how much contrast it applies. Must be specified as a percentage
  118. value from 0% to 100%. Only affects the color keywords.
  119. * *$v-shadow*
  120. ** The main shadow style for all components. Very few components specify
  121. have a shadow by default, and overlay elements define their own specific
  122. shadow style. The syntax is the same as for $v-bevel, but without the
  123. inset.
  124. ** You can use the v-tint or v-shade keywords for the color of the
  125. shadows. v-tint is substituted with white and v-shade with black.
  126. * *$v-shadow-opacity*
  127. ** The opacity of the shadow colors. Only affects the color keywords.
  128. * *$v-focus-color*
  129. ** The color of the focus outline/border for focusable elements in the
  130. application. Computed by default. Can be any CSS color value.
  131. * *$v-focus-style*
  132. ** The style of the focus outline for focusable elements in the
  133. application. The syntax is the same as for CSS box-shadow, e.g. +
  134. `$v-focus-style: 0 0 0 2px orange;`
  135. ** You can also specify it to just a color value, in which case only the
  136. border color of the components is affected, and no other outline is
  137. drawn. E.g. `$v-focus-style: orange;`
  138. * *$v-selection-color*
  139. ** The color for any selection highlights in the application (such as
  140. selected items in a Table or ComboBox). Defaults to $v-focus-color. Can
  141. be any CSS color value.
  142. * *$v-error-indicator-color*
  143. ** The color for error indicators, and any error related styles in the
  144. application (such as the error style Notification). Can be any CSS color
  145. value.
  146. [[color-keywords]]
  147. Color Keywords
  148. ~~~~~~~~~~~~~~
  149. Valo offers three custom color keywords which you can use with
  150. $v-border, $v-bevel and $v-shadow in place of a regular CSS color value:
  151. *v-tint*, *v-shade* and *v-tone*. The keywords work in the following
  152. way:
  153. * v-tint will be lighter version of the color it is applied on
  154. * v-shade will be a darker version of the color it is applied on
  155. * v-tone depends on the luminance value of the color on which it is
  156. applied on:
  157. ** If the color is dark, then the resulting color will be a lighter
  158. version of that same color
  159. ** If the color is light, then the resulting color will be darker
  160. version of that same color
  161. The keywords can optionally be weighted with additional numeric values,
  162. if you wish to fine tune the end result. Examples:
  163. * `$v-border: 1px solid v-shade;`
  164. * `$v-border: 2px solid (v-tint 2);`
  165. * `$v-border: 1px solid (v-tone 0.5);`
  166. [[additional-style-names]]
  167. Additional Style Names
  168. ~~~~~~~~~~~~~~~~~~~~~~
  169. Use the `ValoTheme` Java class for additional style names for many
  170. components.