variables.html 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. ---
  2. title: Variables
  3. subtitle: "Easily <strong>customize</strong> Bulma to match your design"
  4. layout: documentation
  5. doc-tab: overview
  6. doc-subtab: variables
  7. breadcrumb:
  8. - home
  9. - documentation
  10. - overview
  11. - overview-variables
  12. ---
  13. {% assign initial_variables = site.data.variables.utilities.initial-variables %}
  14. {% assign initial_vars = initial_variables.vars %}
  15. {% assign derived_variables = site.data.variables.utilities.derived-variables %}
  16. {% assign derived_vars = derived_variables.vars %}
  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 anchor.html name="Initial variables" %}
  64. <div class="content">
  65. <p>
  66. These are <a href="{{ initial_variables.file_url }}" target="_blank">variables</a> with a <strong>literal</strong> value.
  67. </p>
  68. </div>
  69. <table class="table is-bordered is-striped">
  70. <tbody>
  71. {% for variable_hash in initial_vars %}
  72. {% assign variable = variable_hash[1] %}
  73. {% assign starts_with = variable.value | slice: 0, 3 %}
  74. <tr>
  75. <td>
  76. <code style="white-space: nowrap;">{{ variable.name }}</code>
  77. </td>
  78. <td>
  79. {% if starts_with == 'hsl' %}
  80. <span class="bd-color" style="background: {{ variable.value }};"></span>
  81. {% endif %}
  82. <code>{{ variable.value }}</code>
  83. </td>
  84. </tr>
  85. {% endfor %}
  86. <tbody>
  87. </table>
  88. {% capture custom_message %}
  89. These are <a href="{{ derived_variables.file_url }}" target="_blank">variables</a> with a value that <strong>references</strong> another variable.
  90. {% endcapture %}
  91. {%
  92. include variables.html
  93. anchor_name = 'Derived variables'
  94. data = derived_variables
  95. custom_message = custom_message
  96. table_class = 'is-bordered is-striped'
  97. %}
  98. {% capture custom_message %}
  99. 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>.
  100. {% endcapture %}
  101. {%
  102. include variables.html
  103. anchor_name = 'Generic variables'
  104. tab = 'base'
  105. subtab = 'generic'
  106. custom_message = custom_message
  107. table_class = 'is-bordered is-striped'
  108. %}