662 B · text History bfa2c00
defmodule DiogramosWeb.Api.V1.ThemeController do
  @moduledoc """
  Serves the theme and color-token whitelists so a client can validate a
  color pick — and render a picker — without hardcoding a copy of
  `Diogramos.Themes` that silently drifts.
  """
  use DiogramosWeb, :controller

  alias Diogramos.Diagrams.Document
  alias Diogramos.Themes

  def index(conn, _params) do
    json(conn, %{
      themes: Themes.all(),
      default: Themes.default(),
      color_tokens: Themes.color_tokens(),
      font_families: Document.font_families(),
      label_positions: Document.label_positions(),
      label_sizes: Document.label_sizes()
    })
  end
end