customize.html 3.6 KB

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