🎨Themes
How to change the branding of your project from a list of 20+ options by changing one word.
Last updated
How to change the branding of your project from a list of 20+ options by changing one word.
Last updated
DaisyUI offers a variety of themes that you can easily apply to your Ruby on Rails application. To change the theme, you need to modify the data-theme
attribute in the <body>
tag of your application.html.erb
layout file.
Open your app/views/layouts/application.html.erb
file.
Locate the <html>
tag.
Add or update the data-theme
attribute with the desired theme name. For example:
You can replace "dark" with any theme name provided by DaisyUI.
To see the different themes you can choose from, check the DaisyUI documentation or their themes page below:
In application.html.erb
by changing the data-theme
attribute in the <body>
tag, you can quickly switch between these themes, allowing for a customizable look and feel for your application!
Most definitely! DaisyUi has a lot of components but frankly lacks pre-designed sections, for us developers who don't want to spend hours creating for scratch. You can easily find more Tailwind components in the HyperUI library.
Find a component you like? Just copy/paste it into your LightningRails project.
Pro Tip: Avoid hard-coded color classes in non-DaisyUI components (like HyperUI). For example, using a class like bg-white
won’t adapt to theme changes. This can result in a dark theme with a mismatched white background—definitely not ideal. 😅
If you wish to add a custom theme or modify an existing one. We won't be able to do it on the tailwind config file. This is because the Daisyui library doesn't support the configuration of import maps, so Lightning Rails is using CDN instead.
However, you can always create your custom your custom css methods in application.css
.
To customize the theme colors, add this script to your application.html.erb
before the closing </body>
tag.
To customize the default fonts of your projects, import the custom fonts in application.css
and assign them to your headers and p in that same file.