Skip to content

Commit 04895ff

Browse files
committed
document the remaining styles
1 parent f45efcb commit 04895ff

File tree

5 files changed

+102
-4
lines changed

5 files changed

+102
-4
lines changed

lib/scenic/primitive/style/scissor.ex

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,25 @@
44
#
55

66
defmodule Scenic.Primitive.Style.Scissor do
7-
@moduledoc false
7+
@moduledoc """
8+
Define a "Scissor Rectangle" that drawing will be clipped to.
9+
10+
Example:
11+
12+
graph
13+
|> triangle( {{0,40},{40,40},{40,0}}
14+
miter_limit: 2,
15+
fill: :green,
16+
scissor: {20, 40}
17+
)
18+
19+
## Data
20+
21+
`{width, height}`
22+
23+
* `width` - Width of the scissor rectangle.
24+
* `height` - Height of the scissor rectangle.
25+
"""
826

927
use Scenic.Primitive.Style
1028

lib/scenic/primitive/style/stroke.ex

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,24 @@
44
#
55

66
defmodule Scenic.Primitive.Style.Stroke do
7-
@moduledoc false
7+
@moduledoc """
8+
Draw an outline around a primitive with the given paint.
9+
10+
Example:
11+
12+
graph
13+
|> triangle( {{0,40},{40,40},{40,0}}
14+
miter_limit: 2,
15+
stroke: {2, :green}
16+
)
17+
18+
## Data
19+
20+
`{width, paint}`
21+
22+
* `width` - Width of the border being stroked.
23+
* `:paint` - Any [valid paint](Scenic.Primitive.Style.Paint.html).
24+
"""
825

926
use Scenic.Primitive.Style
1027
alias Scenic.Primitive.Style.Paint

lib/scenic/primitive/style/text_align.ex

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,33 @@
44
#
55

66
defmodule Scenic.Primitive.Style.TextAlign do
7-
@moduledoc false
7+
@moduledoc """
8+
Set the alignment of the text with regard to the start point.
9+
10+
Example:
11+
12+
graph
13+
|> text( "Some Text" text_align: :center_middle )
14+
15+
## Data
16+
17+
`alignment`
18+
19+
The alignment type can be any one of the following
20+
21+
* `left` - Left side horizontally. Base of the text vertically.
22+
* `:right` - Right side horizontally. Base of the text vertically.
23+
* `:center` - Centered horizontally. Base of the text vertically.
24+
* `left_top` - Left side horizontally. Top of the text vertically.
25+
* `:right_top` - Right side horizontally. Top of the text vertically.
26+
* `:center_top` - Centered horizontally. Top of the text vertically.
27+
* `left_middle` - Left side horizontally. Centered vertically.
28+
* `:right_middle` - Right side horizontally. Centered vertically.
29+
* `:center_middle` - Centered horizontally. Centered vertically.
30+
* `left_bottom` - Left side horizontally. Bottom of the text vertically.
31+
* `:right_bottom` - Right side horizontally. Bottom of the text vertically.
32+
* `:center_bottom` - Centered horizontally. Bottom of the text vertically.
33+
"""
834

935
use Scenic.Primitive.Style
1036
# alias Scenic.Primitive.Style

lib/scenic/primitive/style/text_height.ex

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,23 @@
44
#
55

66
defmodule Scenic.Primitive.Style.TextHeight do
7-
@moduledoc false
7+
@moduledoc """
8+
Set the vertical spacing of lines of text in a single block.
9+
10+
Example:
11+
12+
graph
13+
|> text( "Some Text\\r\\nMore Text" text_height: 50 )
14+
15+
The natural vertical spacing of the font is used by default. Set this style if
16+
you want to override it.
17+
18+
## Data
19+
20+
`spacing`
21+
22+
* `spacing` - Vertical spacing from line to line.
23+
"""
824

925
use Scenic.Primitive.Style
1026
# alias Scenic.Primitive.Style

lib/scenic/primitive/style/theme.ex

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,27 @@ defmodule Scenic.Primitive.Style.Theme do
1212
1313
Unlike other styles, these are a guide to the components.
1414
Each component gets to pick, choose, or ignore any colors in a given style.
15+
16+
## Main Predefined Themes
17+
* `:dark` - This is the default and most common. Use when the background is dark.
18+
* `:light` - Use when the background is light colored.
19+
20+
## Specialty Themes
21+
22+
The remaining themes are designed to color the standard components and don't really
23+
make much sense when applied to the root of a graph. You could, but it would be...
24+
interesting.
25+
26+
The most obvious place to use them is with [`Button`](Scenic.Component.Button.html)
27+
components.
28+
29+
* `:primary` - Blue background. This is the primary button type indicator.
30+
* `:secondary` - Grey background. Not primary type indicator.
31+
* `:success` - Green background.
32+
* `:danger` - Red background. Use for irreversible or dangerous actions.
33+
* `:warning` - Orange background.
34+
* `:info` - Lightish blue background.
35+
* `:text` - Transparent background.
1536
"""
1637

1738
use Scenic.Primitive.Style

0 commit comments

Comments
 (0)