variables.html 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. ---
  2. title: Variables
  3. layout: documentation
  4. doc-tab: overview
  5. doc-subtab: variables
  6. breadcrumb:
  7. - home
  8. - documentation
  9. - overview
  10. - overview-variables
  11. ---
  12. <meta http-equiv="refresh" content="0; url={{ site.url }}/documentation/customize/variables/">
  13. {% assign initial_variables = site.data.variables.utilities.initial-variables %}
  14. {% assign initial_vars = initial_variables.by_name %}
  15. {% assign derived_variables = site.data.variables.utilities.derived-variables %}
  16. {% assign derived_vars = derived_variables.by_name %}
  17. <div class="content">
  18. <p>Bulma has <strong>two</strong> variable files divided into <strong>4</strong> sections:</p>
  19. <ol>
  20. <li>
  21. <strong>Initial variables</strong>: where you define variables by <strong>literal value</strong>, like:
  22. <ul>
  23. <li><strong>colors</strong>: <code>{{ initial_vars['$blue'].name }}: {{ initial_vars['$blue'].value }}</code></li>
  24. <li><strong>font sizes</strong>: <code>{{ initial_vars['$size-1'].name }}: {{ initial_vars['$size-1'].value }}</code></li>
  25. <li><strong>dimensions</strong>: <code>{{ initial_vars['$gap'].name }}: {{ initial_vars['$gap'].value }}</code></li>
  26. <li><strong>other values</strong>: <code>{{ initial_vars['$easing'].name }}: {{ initial_vars['$easing'].value }}</code> or <code>{{ initial_vars['$radius-large'].name }}: {{ initial_vars['$radius-large'].value }}</code></li>
  27. </ul>
  28. </li>
  29. <li>
  30. <strong>Derived variables</strong> where variables are <strong>calculated</strong> from the values set in the previous file. For example, you can have:
  31. <ul>
  32. <li>
  33. <strong>Primary colors</strong> derived from the initial variables:
  34. <ul>
  35. <li><code>{{ derived_vars['$primary'].name }}: {{ derived_vars['$primary'].value }}</code></li>
  36. <li><code>{{ derived_vars['$link'].name }}: {{ derived_vars['$link'].value }}</code></li>
  37. <li><code>{{ derived_vars['$info'].name }}: {{ derived_vars['$info'].value }}</code></li>
  38. <li><code>{{ derived_vars['$success'].name }}: {{ derived_vars['$success'].value }}</code></li>
  39. <li><code>{{ derived_vars['$warning'].name }}: {{ derived_vars['$warning'].value }}</code></li>
  40. <li><code>{{ derived_vars['$danger'].name }}: {{ derived_vars['$danger'].value }}</code></li>
  41. <li><code>{{ derived_vars['$dark'].name }}: {{ derived_vars['$dark'].value }}</code></li>
  42. <li><code>{{ derived_vars['$text'].name }}: {{ derived_vars['$text'].value }}</code></li>
  43. </ul>
  44. </li>
  45. <li><code>{{ derived_vars['$background'].name }}: {{ derived_vars['$background'].value }}</code>: a general background color</li>
  46. <li><code>{{ derived_vars['$link'].name }}: {{ derived_vars['$link'].value }}</code>: the links use the primary color</li>
  47. <li><code>{{ derived_vars['$family-primary'].name }}: {{ derived_vars['$family-primary'].value }}</code>: the primary font family is the sans-serif one</li>
  48. <li>
  49. <strong>Lists and maps</strong> which are collections of already defined variables:
  50. <ul>
  51. <li><code>{{ derived_vars['$colors'].name }}: {{ derived_vars['$colors'].value }}</code></li>
  52. <li><code>{{ derived_vars['$shades'].name }}: {{ derived_vars['$shades'].value }}</code></li>
  53. <li><code>{{ derived_vars['$sizes'].name }}: {{ derived_vars['$sizes'].value }}</code></li>
  54. </ul>
  55. </li>
  56. </ul>
  57. </li>
  58. </ol>
  59. <p>
  60. To <strong>override</strong> any of these variables, just set them <em>before</em> importing Bulma.
  61. </p>
  62. </div>
  63. {% include elements/anchor.html name="Initial variables" %}
  64. <div class="content">
  65. <p>
  66. These are <a href="https://github.com/jgthms/bulma/blob/master/sass/{{ initial_variables.file_path }}" target="_blank" rel="nofollow">initial variables</a> with a <strong>literal</strong> value.
  67. </p>
  68. </div>
  69. <table class="table is-bordered">
  70. <tbody>
  71. {% for variable_name in initial_variables.list %}
  72. {% assign variable = initial_vars[variable_name] %}
  73. {% include elements/variable-row.html variable=variable hide_computed =true%}
  74. {% endfor %}
  75. <tbody>
  76. </table>
  77. {% capture custom_message %}
  78. These are <a href="https://github.com/jgthms/bulma/blob/master/sass/{{ derived_variables.file_path }}" target="_blank" rel="nofollow">variables</a> with a value that <strong>references</strong> another variable.
  79. {% endcapture %}
  80. {%
  81. include elements/variables.html
  82. anchor_name = 'Derived variables'
  83. data = derived_variables
  84. custom_message = custom_message
  85. table_class = 'is-bordered'
  86. %}
  87. {% capture custom_message %}
  88. You can use the following <a href="{{ site.data.variables.base.generic.file_url }}" target="_blank">generic variables</a> for general <strong>customization</strong>. Simply set one or multiple of these variables <em>before</em> importing Bulma. <a href="{{ site.url }}/documentation/overview/customize/">Learn how</a>.
  89. {% endcapture %}
  90. {%
  91. include elements/variables.html
  92. anchor_name = 'Generic variables'
  93. tab = 'base'
  94. subtab = 'generic'
  95. custom_message = custom_message
  96. table_class = 'is-bordered'
  97. %}