Skip to content

Commit c281638

Browse files
committed
add some documentation for themes
1 parent 26feb2d commit c281638

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

lib/scenic/themes.ex

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,48 @@
11
defmodule Scenic.Themes do
2+
@moduledoc """
3+
Manages theme libraries by registering your map of themes to a library key.
4+
By registering themes in this way you can safely pull in themes from external libraries,
5+
without theme names colliding, as well as get all the validation.
6+
7+
### Required Configuration
8+
Setting up themes requires some initial setup.
9+
10+
Example:
11+
12+
```elixir
13+
defmodule MyApplication.Themes do
14+
@themes %{
15+
light: @theme_light,
16+
dark: @theme_dark,
17+
primary: @primary,
18+
secondary: @secondary,
19+
success: @success,
20+
danger: @danger,
21+
warning: @warning,
22+
info: @info,
23+
text: @text
24+
}
25+
26+
use Scenic.Themes,
27+
sources: [
28+
{:scenic, Scenic.Themes"},
29+
{:my_app, load()}
30+
]
31+
32+
def load(), do: @themes
33+
end
34+
```
35+
36+
After the Themes modules has been defined you need to configure it in your config file.any()
37+
38+
```elixir
39+
config :scenic, :themes,
40+
module: MyApplication.Themes
41+
```
42+
43+
Now themes are passed around scenic in the form of `{:library_name, :theme_name}` as opposed to just :theme_name.
44+
"""
45+
246
@theme_light %{
347
text: :black,
448
background: :white,

0 commit comments

Comments
 (0)