variables.html 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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.by_name %}
  14. {% assign derived_variables = site.data.variables.utilities.derived-variables %}
  15. {% assign derived_vars = derived_variables.by_name %}
  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="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.
  66. </p>
  67. </div>
  68. <table class="table is-bordered">
  69. <tbody>
  70. {% for variable_name in initial_variables.list %}
  71. {% assign variable = initial_vars[variable_name] %}
  72. {% include elements/variable-row.html variable=variable hide_computed =true%}
  73. {% endfor %}
  74. <tbody>
  75. </table>
  76. {% capture custom_message %}
  77. 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.
  78. {% endcapture %}
  79. {%
  80. include elements/variables.html
  81. anchor_name = 'Derived variables'
  82. data = derived_variables
  83. custom_message = custom_message
  84. table_class = 'is-bordered'
  85. %}
  86. {% capture custom_message %}
  87. 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>.
  88. {% endcapture %}
  89. {%
  90. include elements/variables.html
  91. anchor_name = 'Generic variables'
  92. tab = 'base'
  93. subtab = 'generic'
  94. custom_message = custom_message
  95. table_class = 'is-bordered'
  96. %}