Theme

A shared folder with AI prompts and code snippets

From workspace: HeroUI Chat

Team: Main

Total snippets: 11

HeroUI Chat

Theme

11 snippets

Type 3

ThemeColors

type ColorScale = { 50: string; 100: string; 200: string; 300: string; 400: string; 500: string; 600: string; 700: string; 800: string; 900: string; foreground: string; // contrast color DEFAULT: string; }; type BaseColors...

Type 2

LayoutTheme

type BaseThemeUnit = { small?: string; medium?: string; large?: string; }; type FontThemeUnit = { small?: string; medium?: string; large?: string; tiny?: string; }; interface LayoutTheme { /** * The default font size applied...

Type 1

ConfigThemes

type ConfigTheme = { extend?: "light" | "dark"; // base theme to extend layout?: LayoutTheme; // see LayoutTheme colors?: ThemeColors; // see ThemeColors }; type ConfigThemes = Record<string, ConfigTheme>;

API Reference

The following table provides an overview of the various attributes you can use when working with themes in HeroUI:

.

Theme based variants

HeroUI enables you to apply TailwindCSS styles based on the currently active theme. Below are examples of how to do this:

<!-- In dark theme, background will be dark and text will be light. In light theme, background will be light and text will be dark --> <div class="dark dark:bg-gray-800 dark:text-white bg-white text-black"> ... <div>Text color changes...

Nested themes

HeroUI supports nested themes, allowing you to apply different themes to different sections of your application:

<html class="dark"> ... <div class="light">...</div> <div class="purple-dark">...</div> </html>

Themes Options

These are the options that you can use to apply custom configurations to your themes.

module.exports = { plugins: [ heroui({ themes: { light: { layout: {}, colors: {} }, dark: { layout: {}, colors: {} }, ... // custom themes } }) ...

Default Plugin Options

The heroui plugin provides a default structure. It is outlined as follows:

module.exports = { plugins: [ heroui({ prefix: "heroui", // prefix for themes variables addCommonColors: false, // override common colors (e.g. "blue", "green", "pink"). defaultTheme: "light", // default theme from the...

Usage 2

// main.tsx or main.jsx import React from "react"; import ReactDOM from "react-dom/client"; import {HeroUIProvider} from "@heroui/react"; import App from "./App"; import "./index.css"; ReactDOM.createRoot(document.getElementById("root")).render( ...

Usage 1

After adding the plugin to your tailwind.config.js file, you can utilize any of the default themes (light/dark) or a custom one. Here's how you can apply these themes in your main.jsx or main.tsx:

Go to the src directory and inside main.jsx or main.tsx, apply the following class names to the root element: light for the light theme. dark for the dark theme. text-foreground to set the text color. bg-background to set the background color.

Setup

The first step to using HeroUI's theming capability is adding the heroui plugin to your tailwind.config.js file. Below is an example of how to do this:

// tailwind.config.js const {heroui} = require("@heroui/react"); /** @type {import('tailwindcss').Config} */ module.exports = { content: [ // ... // make sure it's pointing to the ROOT node_module ...

HeroUI Chat - Theme - AI Prompts & Code Snippets | Snippets AI