customization

Colors

Explore FlyonUI's color system with semantic classes and CSS variables.

FlyonUI offers a robust and flexible color system that allows you to manage themes and colors seamlessly. Instead of relying on hard-coded utility color classes like:

  • bg-red-500
  • bg-lime-500
  • bg-fuchsia-500

FlyonUI encourages the use of semantic color utility classes such as:

  • bg-primary
  • bg-info
  • bg-error

These semantic classes simplify theme customization and management across multiple modes (e.g., dark or light themes). Each theme dynamically assigns colors to these classes via CSS variables, allowing your design to adapt effortlessly to theme changes.

Using semantic color names provides a more organized, consistent approach to your design system. Instead of randomly picking colors for each component, you define a palette with specific roles (e.g., primary, secondary). This approach ensures:

  • Consistency: Enforces a unified color palette across your UI.
  • Theming Flexibility: Allows for seamless switching between themes, with colors automatically adapting through CSS variables.
  • Scalability: Easily extend the system to support multiple themes (beyond just light and dark) by simply modifying a few CSS variables.

FlyonUI provides a comprehensive list of color options, which can be used either within themes or as utility classes. Below is a table of available color options, along with examples of how to use them.

Color nameRequired or optionalExample use

primary

Primary color

Required
Class name: bg-primary
CSS variable: oklch(var(--p))

primary-content

Foreground color to apply over the primary color.

Optional

If not specified, a readable variant of the primary color is applied.

Class name: bg-primary-content
CSS variable: oklch(var(--pc))

secondary

Secondary color

Required
Class name: bg-secondary
CSS variable: oklch(var(--s))

secondary-content

Foreground color to apply over the secondary color.

Optional

If not specified, a readable variant of the secondary color is applied.

Class name: bg-secondary-content
CSS variable: oklch(var(--sc))

accent

Accent color

Required
Class name: bg-accent
CSS variable: oklch(var(--a))

accent-content

Foreground color to apply over the accent color.

Optional

If not specified, a readable variant of the accent color is applied.

Class name: bg-accent-content
CSS variable: oklch(var(--ac))

neutral

Neutral color

Required
Class name: bg-neutral
CSS variable: oklch(var(--n))

neutral-content

Foreground color to apply over the neutral color.

Optional

If not specified, a readable variant of the neutral color is applied.

Class name: bg-neutral-content
CSS variable: oklch(var(--nc))

base-100

The page’s base shade, applied to empty background areas.

Required
Class name: bg-base-100
CSS variable: oklch(var(--b1))

base-200

A little darker variant of base color

Optional

Will be a darker tone of base-100 if not specified

Class name: bg-base-200
CSS variable: oklch(var(--b2))

base-300

A even more darker variant of base color

Optional

Will be a darker tone of base-200 if not specified

Class name: bg-base-300
CSS variable: oklch(var(--b3))

base-content

Foreground color to apply over the base color.

Optional

If not specified, a readable variant of the base color is applied.

Class name: bg-base-content
CSS variable: oklch(var(--bc))

base-shadow

Used to creates consistent shadows with varying depths

Optional

If not specified, a little darker variant of the `base-100` color is applied.

Class name: bg-base-shadow
CSS variable: oklch(var(--bs))

info

Info color

Optional

If not specified, default blue color will be added.

Class name: bg-info
CSS variable: oklch(var(--in))

info-content

Foreground color to apply over the info color.

Optional

If not specified, a readable variant of the info color is applied.

Class name: bg-info-content
CSS variable: oklch(var(--inc))

success

Success color

Optional

If not specified, default green color will be added.

Class name: bg-success
CSS variable: oklch(var(--su))

success-content

Foreground color to apply over the success color.

Optional

If not specified, a readable variant of the success color is applied.

Class name: bg-success-content
CSS variable: oklch(var(--suc))

warning

Warning color

Optional

If not specified, default orange color will be added.

Class name: bg-warning
CSS variable: oklch(var(--wa))

warning-content

Foreground color to apply over the warning color.

Optional

If not specified, a readable variant of the warning color is applied.

Class name: bg-warning-content
CSS variable: oklch(var(--wac))

error

Error color

Optional

If not specified, default red color will be added.

Class name: bg-error
CSS variable: oklch(var(--er))

error-content

Foreground color to apply over the error color.

Optional

If not specified, a readable variant of the error color is applied.

Class name: bg-error-content
CSS variable: oklch(var(--erc))

FlyonUI components come with predefined color utility classes. To apply colors to your components, simply use one of these classes:

<span class="badge badge-primary">Badge</span>

Or for input elements:

<input type="radio" class="radio radio-primary" />

FlyonUI’s color utilities follow a similar pattern to Tailwind’s default color utilities. You can easily apply colors to various aspects of your UI using the following syntax:

bg-{COLOR_NAME}
to-{COLOR_NAME}
via-{COLOR_NAME}
from-{COLOR_NAME}
text-{COLOR_NAME}
ring-{COLOR_NAME}
fill-{COLOR_NAME}
caret-{COLOR_NAME}
stroke-{COLOR_NAME}
border-{COLOR_NAME}
divide-{COLOR_NAME}
accent-{COLOR_NAME}
shadow-{COLOR_NAME}
outline-{COLOR_NAME}
decoration-{COLOR_NAME}
placeholder-{COLOR_NAME}
ring-offset-{COLOR_NAME}

For example:

  • Background color: bg-primary
  • Text color: text-secondary
  • Border color: border-accent
  • Shadow color: shadow-primary

With this system, you can easily apply semantic colors throughout your UI, making theme switching and color management intuitive and scalable.