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

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