# `OGMate`
[🔗](https://github.com/joladev/og_mate/blob/v0.1.0/lib/og_mate.ex#L1)

Builds PNG images at compile time from a user-provided key list and
content function. Always returns `{:ok, bytes}` from `image_for/1`.
Unknown keys resolve to the pre-built default image.

## Example

    defmodule MyApp.OGImage do
      use OGMate,
        all_keys: ["home", "about"],
        content_for: MyApp.OGContent,
        theme: [
          background: "#0a0a0a",
          foreground: "#ffffff",
          font: "Inter",
          secondary: "#a3a3a3",
          logo: "priv/static/images/logo.png",
          site_name: "myapp.com"
        ],
        default: {"MyApp", "A brief site description."}
    end

    {:ok, png} = MyApp.OGImage.image_for("home")

## Custom Renderer

Pass a `renderer:` module that exports `render(title, description)`:

    defmodule MyApp.OGRenderer do
      def render(title, description), do: {:ok, png}
    end

    defmodule MyApp.OGImage do
      use OGMate,
        all_keys: [...],
        content_for: ...,
        renderer: MyApp.OGRenderer,
        default: {...}
    end

`:theme` and `:renderer` are mutually exclusive.

See `OGMate.Options` for the full option contract, and the
[Getting started guide](getting_started.md) for end-to-end setup.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
