customize.html 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. ---
  2. title: Customize Bulma
  3. layout: documentation
  4. doc-tab: overview
  5. doc-subtab: customize
  6. ---
  7. {% capture sass %}
  8. // 1. Import the initial variables
  9. @import "../sass/utilities/initial-variables"
  10. // 2. Set your own initial variables
  11. // Update blue
  12. $blue: #72d0eb
  13. // Add pink and its invert
  14. $pink: #ffb3b3
  15. $pink-invert: #fff
  16. // Add a serif family
  17. $family-serif: "Merriweather", "Georgia", serif
  18. // 3. Set the derived variables
  19. // Use the new pink as the primary color
  20. $primary: $pink
  21. $primary-invert: $pink-invert
  22. // Use the existing orange as the danger color
  23. $danger: $orange
  24. // Use the new serif family
  25. $family-primary: $family-serif
  26. // 4. Setup your Custom Colors
  27. $linkedin: #0077B5
  28. $linkedin-invert: findColorInvert($linkedin)
  29. $twitter: #1DA1F2
  30. $twitter-invert: findColorInvert($twitter)
  31. $github: #222222
  32. $github-invert: findColorInvert($github)
  33. // Add new color variables to the color map.
  34. $addColors: (
  35. "twitter":($twitter, $twitter-invert),
  36. "linkedin": ($linkedin, $linkedin-invert),
  37. "github": ($github, $github-invert)
  38. )
  39. $colors: map-merge($colors, $addColors)
  40. // 5. Import the rest of Bulma
  41. @import "../bulma"
  42. {% endcapture %}
  43. {% include subnav-overview.html %}
  44. <section class="section">
  45. <div class="container">
  46. <h1 class="title">Customizing with Sass</h1>
  47. <h2 class="subtitle">Create your <strong>own theme</strong> with a simple set of <strong>variables</strong></h2>
  48. <hr>
  49. <div class="content">
  50. <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>
  51. </div>
  52. <article class="media is-large">
  53. <div class="media-left">
  54. <p class="title is-5">1</p>
  55. </div>
  56. <div class="media-content">
  57. <p class="title is-5">
  58. <strong>Download</strong> the source files:
  59. </p>
  60. {% highlight bash %}npm install bulma{% endhighlight %}
  61. <div class="content">or clone the repository: <a href="https://github.com/jgthms/bulma">https://github.com/jgthms/bulma</a></div>
  62. </div>
  63. </article>
  64. <article class="media is-large">
  65. <div class="media-left">
  66. <p class="title is-5">2</p>
  67. </div>
  68. <div class="media-content">
  69. <p class="title is-5">
  70. <strong>Set</strong> your variables
  71. </p>
  72. <p class="subtitle is-6">
  73. Add your own colors, set new fonts, override Bulma's default styles...
  74. </p>
  75. <div class="highlight-full">
  76. {% highlight sass %}{{ sass }}{% endhighlight %}
  77. </div>
  78. </div>
  79. </article>
  80. <article class="media is-large">
  81. <div class="media-left">
  82. <p class="title is-5">3</p>
  83. </div>
  84. <div class="media-content">
  85. <p class="title is-5">
  86. See the <strong>result</strong>: before and after
  87. </p>
  88. <p class="subtitle is-6">
  89. 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>
  90. </p>
  91. <figure>
  92. <img width="640" height="640" src="{{site.url}}/images/customize-before.png" alt="Customizing Bulma with Sass">
  93. <img width="640" height="640" src="{{site.url}}/images/customize-after.png" alt="Customizing Bulma with Sass">
  94. </figure>
  95. </div>
  96. </article>
  97. </div>
  98. </section>