variables.html 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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. {% assign initial_variables = site.data.variables.utilities.initial-variables %}
  13. {% assign initial_vars = initial_variables.vars %}
  14. {% assign derived_variables = site.data.variables.utilities.derived-variables %}
  15. {% assign derived_vars = derived_variables.vars %}
  16. <div class="content">
  17. <p>Bulma has <strong>two</strong> variable files divided into <strong>4</strong> sections:</p>
  18. <ol>
  19. <li>
  20. <strong>Initial variables</strong>: where you define variables by <strong>literal value</strong>, like:
  21. <ul>
  22. <li><strong>colors</strong>: <code>{{ initial_vars.blue.name }}: {{ initial_vars.blue.value }}</code></li>
  23. <li><strong>font sizes</strong>: <code>{{ initial_vars.size-1.name }}: {{ initial_vars.size-1.value }}</code></li>
  24. <li><strong>dimensions</strong>: <code>{{ initial_vars.gap.name }}: {{ initial_vars.gap.value }}</code></li>
  25. <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>
  26. </ul>
  27. </li>
  28. <li>
  29. <strong>Derived variables</strong> where variables are <strong>calculated</strong> from the values set in the previous file. For example, you can have:
  30. <ul>
  31. <li>
  32. <strong>Primary colors</strong> derived from the initial variables:
  33. <ul>
  34. <li><code>{{ derived_vars.primary.name }}: {{ derived_vars.primary.value }}</code></li>
  35. <li><code>{{ derived_vars.link.name }}: {{ derived_vars.link.value }}</code></li>
  36. <li><code>{{ derived_vars.info.name }}: {{ derived_vars.info.value }}</code></li>
  37. <li><code>{{ derived_vars.success.name }}: {{ derived_vars.success.value }}</code></li>
  38. <li><code>{{ derived_vars.warning.name }}: {{ derived_vars.warning.value }}</code></li>
  39. <li><code>{{ derived_vars.danger.name }}: {{ derived_vars.danger.value }}</code></li>
  40. <li><code>{{ derived_vars.dark.name }}: {{ derived_vars.dark.value }}</code></li>
  41. <li><code>{{ derived_vars.text.name }}: {{ derived_vars.text.value }}</code></li>
  42. </ul>
  43. </li>
  44. <li><code>{{ derived_vars.background.name }}: {{ derived_vars.background.value }}</code>: a general background color</li>
  45. <li><code>{{ derived_vars.link.name }}: {{ derived_vars.link.value }}</code>: the links use the primary color</li>
  46. <li><code>{{ derived_vars.family-primary.name }}: {{ derived_vars.family-primary.value }}</code>: the primary font family is the sans-serif one</li>
  47. <li>
  48. <strong>Lists and maps</strong> which are collections of already defined variables:
  49. <ul>
  50. <li><code>{{ derived_vars.colors.name }}: {{ derived_vars.colors.value }}</code></li>
  51. <li><code>{{ derived_vars.shades.name }}: {{ derived_vars.shades.value }}</code></li>
  52. <li><code>{{ derived_vars.sizes.name }}: {{ derived_vars.sizes.value }}</code></li>
  53. </ul>
  54. </li>
  55. </ul>
  56. </li>
  57. </ol>
  58. <p>
  59. To <strong>override</strong> any of these variables, just set them <em>before</em> importing Bulma.
  60. </p>
  61. </div>
  62. {% include elements/anchor.html name="Initial variables" %}
  63. <div class="content">
  64. <p>
  65. These are <a href="{{ initial_variables.file_url }}" target="_blank">variables</a> with a <strong>literal</strong> value.
  66. </p>
  67. </div>
  68. <table class="table is-bordered is-striped">
  69. <tbody>
  70. {% for variable_hash in initial_vars %}
  71. {% assign variable = variable_hash[1] %}
  72. {% assign starts_with = variable.value | slice: 0, 3 %}
  73. <tr>
  74. <td>
  75. <code style="white-space: nowrap;">{{ variable.name }}</code>
  76. </td>
  77. <td>
  78. {% if starts_with == 'hsl' %}
  79. <span class="bd-color" style="background: {{ variable.value }};"></span>
  80. {% endif %}
  81. <code>{{ variable.value }}</code>
  82. </td>
  83. </tr>
  84. {% endfor %}
  85. <tbody>
  86. </table>
  87. {% capture custom_message %}
  88. These are <a href="{{ derived_variables.file_url }}" target="_blank">variables</a> with a value that <strong>references</strong> another variable.
  89. {% endcapture %}
  90. {%
  91. include elements/variables.html
  92. anchor_name = 'Derived variables'
  93. data = derived_variables
  94. custom_message = custom_message
  95. table_class = 'is-bordered is-striped'
  96. %}
  97. {% capture custom_message %}
  98. 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>.
  99. {% endcapture %}
  100. {%
  101. include elements/variables.html
  102. anchor_name = 'Generic variables'
  103. tab = 'base'
  104. subtab = 'generic'
  105. custom_message = custom_message
  106. table_class = 'is-bordered is-striped'
  107. %}