Cinder.Theme (Cinder v0.1.1)

View Source

Theme management for Cinder table components.

Provides default themes and utilities for merging custom theme configurations. Also supports the new Spark DSL for defining modular themes.

Basic Usage (Map-based themes)

# Using built-in themes
theme = Cinder.Theme.merge("modern")

# Using custom map
theme = Cinder.Theme.merge(%{
  container_class: "my-custom-container",
  table_class: "my-custom-table"
})

Advanced Usage (DSL-based themes)

defmodule MyApp.CustomTheme do
  use Cinder.Theme

  override Cinder.Components.Table do
    set :container_class, "my-custom-table-container"
    set :row_class, "my-custom-row hover:bg-blue-50"
  end
end

theme = Cinder.Theme.merge(MyApp.CustomTheme)

Summary

Functions

Gets all available theme properties across all components.

Gets the complete default theme by merging all component defaults.

Returns the default theme configuration.

Merges a custom theme configuration with the default theme.

Returns a list of available theme presets.

Validates a theme configuration.

Types

theme()

@type theme() :: %{required(atom()) => String.t()}

Functions

all_theme_properties()

Gets all available theme properties across all components.

complete_default()

Gets the complete default theme by merging all component defaults.

default()

Returns the default theme configuration.

merge(theme_config)

Merges a custom theme configuration with the default theme.

Examples

iex> Cinder.Theme.merge(%{container_class: "my-custom-class"})
%{container_class: "my-custom-class", ...}

iex> Cinder.Theme.merge("modern")
%{container_class: "bg-white shadow-lg rounded-xl border border-gray-100 overflow-hidden", ...}

presets()

Returns a list of available theme presets.

validate(theme_config)

Validates a theme configuration.

Returns :ok if the theme is valid, or {:error, reason} if invalid.