File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change 1
1
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
+
2
46
@ theme_light % {
3
47
text: :black ,
4
48
background: :white ,
You can’t perform that action at this time.
0 commit comments