1
0
mirror of https://github.com/tabler/tabler.git synced 2025-12-21 17:34:25 +04:00
Files

112 KiB

title, description, summary
title description summary
Customization Customize the illustrations to match your brand. Learn how to tailor Tabler Illustrations by adjusting colors, sizes, and formats. This section provides insights into seamlessly integrating illustrations to align with your design and branding.

{% capture html -%} {%- endcapture %} {% include "docs/example.html" html=html %}

Color of the illustration

You can change the color of the illustration by setting the --tblr-illustrations-primary CSS variable to the desired color. This will change the color of the primary elements in the illustration.

<div style="--tblr-illustrations-primary: #cc0000">
  <svg>...</svg>
</div>

You can customize it globally by setting the variable on the body element or locally by setting it on a parent element.

body {
--tblr-illustrations-primary: #CC0000;
}

{% capture html -%}

{%- endcapture %} {% include "docs/example.html" html=html %}

Color of the skin

To change the color of the skin, use the --tblr-illustrations-skin CSS variable.

<div style="--tblr-illustrations-skin: #5a433c">
  <svg>...</svg>
</div>

Look at the example below to see how you can change the color of the skin.

{% capture html -%}

{%- endcapture %} {% include "docs/example.html" html=html %}

Application Brand Color

Tabler Illustrations uses --tblr-primary as a fallback color if --tblr-illustrations-primary is not set, so if you have a primary color set in your design system, you can use that to ensure consistency across your project.

{% capture html -%}

Primary Button
Checked checkbox input
<script> document.querySelectorAll(".form-colorinput-input").forEach((input) => { input.addEventListener("change", (event) => { document.documentElement.style.setProperty( "--tblr-primary", `var(--tblr-${event.target.value})`, ); }); }); </script> {%- endcapture %} {% include "docs/example.html" html=html %}

Dark version of the illustration

Each illustration has a dark mode variant. To use it, copy the dark mode SVG code and paste it into your project. The dark mode variant is available for all illustrations.

{% capture html -%}

{%- endcapture %} {% include "docs/example.html" html=html %}

Autodark mode

Tabler Illustrations supports autodark mode, which automatically switches the color scheme of the illustrations based on the user's system preferences. To enable autodark mode, copy illustration code from the svg-css-autodark folder.

Illustrations change theme based on the user's system preferences or data-bs-theme attribute or theme class.

<html data-bs-theme="dark">
  <body>
    <svg>...</svg>
  </body>
</html>

Look at the example below to see how the illustration changes based on the user's system preferences.

{% capture html -%}

<style> :where(.theme-dark, [data-bs-theme="dark"]) .tblr-illustrations-boy-girl-a { fill: black; opacity: 0.07; } :where(.theme-dark, [data-bs-theme="dark"]) .tblr-illustrations-boy-girl-b { fill: #1a2030; } :where(.theme-dark, [data-bs-theme="dark"]) .tblr-illustrations-boy-girl-c { fill: #454c5e; } @media (prefers-color-scheme: dark) { .tblr-illustrations-boy-girl-a { fill: black; opacity: 0.07; } .tblr-illustrations-boy-girl-b { fill: #1a2030; } .tblr-illustrations-boy-girl-c { fill: #454c5e; } } </style>

Light Dark
<script> const toggleTheme = (theme) => { if (theme === "dark") { document.documentElement.setAttribute("data-bs-theme", "dark"); } else { document.documentElement.setAttribute("data-bs-theme", "light"); } }; document.querySelectorAll(".form-check-input").forEach((input) => { input.addEventListener("change", (e) => { console.log(e.target.value); toggleTheme(e.target.value); }); }); </script> {%- endcapture %} {% include "docs/example.html" html=html %}