customize.html 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. ---
  2. layout: documentation
  3. doc-tab: overview
  4. doc-subtab: customize
  5. ---
  6. {% include subnav-overview.html %}
  7. <section class="section">
  8. <div class="container">
  9. <h1 class="title">Customizing with Sass</h1>
  10. <h2 class="subtitle">Create your <strong>own theme</strong> with a simple set of <strong>variables</strong></h2>
  11. <hr>
  12. <div class="content">
  13. <p>If you're familiar with <a href="http://sass-lang.com/">Sass</a> and want to <strong>customize</strong> Bulma with your own colors and variables, just install Bulma via <strong>npm</strong>:</p>
  14. </div>
  15. <article class="media is-large">
  16. <div class="media-left">
  17. <p class="title is-5">1</p>
  18. </div>
  19. <div class="media-content">
  20. <p class="title is-5">
  21. <strong>Download</strong> the source files:
  22. </p>
  23. {% highlight bash %}
  24. npm install bulma
  25. {% endhighlight %}
  26. <div class="content">or clone the repository: <a href="https://github.com/jgthms/bulma">https://github.com/jgthms/bulma</a></div>
  27. </div>
  28. </article>
  29. <article class="media is-large">
  30. <div class="media-left">
  31. <p class="title is-5">2</p>
  32. </div>
  33. <div class="media-content">
  34. <p class="title is-5">
  35. <strong>Set</strong> your variables
  36. </p>
  37. <p class="subtitle is-6">
  38. Add your own colors, set new fonts, override Bulma styles...
  39. </p>
  40. {% highlight sass %}
  41. // 1. Import the initial variables
  42. @import "../sass/utilities/initial-variables"
  43. // 2. Set your own initial variables
  44. // Update blue
  45. $blue: #72d0eb
  46. // Add pink and its invert
  47. $pink: #ffb3b3
  48. $pink-invert: #fff
  49. // Add a serif family
  50. $family-serif: "Merriweather", "Georgia", serif
  51. // 3. Set the derived variables
  52. // Use the new pink as the primary color
  53. $primary: $pink
  54. $primary-invert: $pink-invert
  55. // Use the existing orange as the danger color
  56. $danger: $orange
  57. // Use the new serif family
  58. $family-primary: $family-serif
  59. // 4. Import the rest of Bulma
  60. @import "../bulma"
  61. {% endhighlight %}
  62. </p>
  63. </div>
  64. </article>
  65. <article class="media is-large">
  66. <div class="media-left">
  67. <p class="title is-5">3</p>
  68. </div>
  69. <div class="media-content">
  70. <p class="title is-5">
  71. See the <strong>result</strong>: before and after
  72. </p>
  73. <p class="subtitle is-6">
  74. As <code>$blue</code> has been updated, and since <code>$blue-invert</code> is automatically calculated with the <strong>function</strong> <code>$blue-invert: findColorInvert($blue)</code>, the <code>$blue-invert</code> is now black instead of white</p>
  75. </p>
  76. <figure>
  77. <img width="640" height="640" src="{{site.url}}/images/customize-before.png" alt="Customizing Bulma with Sass">
  78. <img width="640" height="640" src="{{site.url}}/images/customize-after.png" alt="Customizing Bulma with Sass">
  79. </figure>
  80. </div>
  81. </article>
  82. </div>
  83. </section>