Skip to content

Commit 7c5aa9c

Browse files
authored
Merge pull request #273 from axelson/center-middle-fix
Small doc update
2 parents db4d76d + 95e764e commit 7c5aa9c

File tree

5 files changed

+28
-31
lines changed

5 files changed

+28
-31
lines changed

lib/scenic/color.ex

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,13 @@ defmodule Scenic.Color do
156156
yellow_green: {0x9A, 0xCD, 0x32}
157157
}
158158

159+
@g :color_g
160+
@ga :color_ga
161+
@rgb :color_rgb
162+
@rgba :color_rgba
163+
@hsv :color_hsv
164+
@hsl :color_hsl
165+
159166
@moduledoc """
160167
APIs to create and work with colors.
161168
@@ -180,15 +187,15 @@ defmodule Scenic.Color do
180187
For HSL and HSV, h is a float between 0 and 360, while the s, v and l values
181188
are floats between 0 and 100.
182189
183-
| Format | Implicit | Explicit |
184-
|---------------|------------------------|-----------|
185-
| Named Color | *na* | See the Named Color Table |
186-
| Grayscale | `g` | `{:g, g}` |
187-
| Gray, Alpha | `{g, a}` | `{:g, {g, a}}` |
188-
| Red, Green, Blue | `{r, g, b}` | `{:rgb, {r, g, b}}` |
189-
| Red, Green, Blue, Alpha | `{r, g, b, a}` | `{:rgba, {r, g, b, a}}` |
190-
| Hue, Saturation, Value | *na* | `{:hsv, {h, s, v}}` |
191-
| Hue, Saturation, Lightness | *na* | `{:hsl, {h, s, l}}` |
190+
| Format | Implicit | Explicit |
191+
|----------------------------|----------------|-----------------------------|
192+
| Named Color | *na* | See the Named Color Table |
193+
| Grayscale | `g` | `{:#{@g}, g}` |
194+
| Gray, Alpha | `{g, a}` | `{:#{@ga}, {g, a}}` |
195+
| Red, Green, Blue | `{r, g, b}` | `{:#{@rgb}, {r, g, b}}` |
196+
| Red, Green, Blue, Alpha | `{r, g, b, a}` | `{:#{@rgba}, {r, g, b, a}}` |
197+
| Hue, Saturation, Value | *na* | `{:#{@hsv}, {h, s, v}}` |
198+
| Hue, Saturation, Lightness | *na* | `{:#{@hsl}, {h, s, l}}` |
192199
193200
194201
## Named Colors
@@ -204,26 +211,20 @@ defmodule Scenic.Color do
204211
205212
## Additional Named Colors
206213
207-
| Name | Value |
208-
|---------------|------------------------|
209-
| `:clear` | `{0x80, 0x80, 0x80, 0x00}` |
214+
| Name | Value |
215+
|---------------|-----------------------------|
216+
| `:clear` | `{0x80, 0x80, 0x80, 0x00}` |
210217
| `:transparent` | `{0x80, 0x80, 0x80, 0x00}` |
211218
212219
## Converting Between Color Formats
213220
214-
By using the functions `to_g`, `to_ga`, `to_rgb`, `to_rgb`, `to_hsl`, and `to_hsv`
215-
you can convert between any implicit or explicit color type to any explicit color type.
221+
By using the functions `to_g/1`, `to_ga/1`, `to_rgb/1`, `to_rgb/1`,
222+
`to_hsl/1`, and `to_hsv/1` you can convert between any implicit or explicit
223+
color type to any explicit color type.
216224
"""
217225

218226
# import IEx
219227

220-
@g :color_g
221-
@ga :color_ga
222-
@rgb :color_rgb
223-
@rgba :color_rgba
224-
@hsv :color_hsv
225-
@hsl :color_hsl
226-
227228
@type implicit ::
228229
atom
229230
| {name :: atom, a :: integer}

lib/scenic/component.ex

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -210,12 +210,8 @@ defmodule Scenic.Component do
210210
# --------------------------------------------------------
211211
defoverridable add_to_graph: 3
212212
end
213-
214-
# quote
215213
end
216214

217-
# defmacro
218-
219215
@filter_out [
220216
:cap,
221217
:fill,
@@ -240,7 +236,6 @@ defmodule Scenic.Component do
240236
# prepare the list of opts to send to a component as it is being started up
241237
# the main task is to remove styles that have already been consumed or don't make
242238
# sense, while leaving any opts/styles that are intended for the component itself.
243-
# also, add the viewport as an option.
244239
@doc false
245240
@spec filter_opts(opts :: Keyword.t()) :: Keyword.t()
246241
def filter_opts(opts) when is_list(opts) do

lib/scenic/graph.ex

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,9 @@ defmodule Scenic.Graph do
6868
that new primitives added to it are inserted into the new group instead of the
6969
root of the graph.
7070
71-
Finally, when the group is finished, a translation matrix and a `:text_align` style
72-
are added to it. These properties are _inherited_ by the primitives in the group.
71+
Finally, when the group is finished, a translation matrix and a `:text_align`
72+
style (see `Scenic.Primitive.Style.TextAlign`) are added to it. These
73+
properties are _inherited_ by the primitives in the group.
7374
7475
## Inheritance
7576

lib/scenic/primitive/style/text_align.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ defmodule Scenic.Primitive.Style.TextAlign do
1111
1212
```elixir
1313
graph
14-
|> text( "Some Text", text_align: :center_middle )
14+
|> text("Some Text", text_align: :center)
1515
```
1616
1717
### Data Format

lib/scenic/primitives.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,8 +1195,8 @@ defmodule Scenic.Primitives do
11951195
then draw it again without blur, slightly offset, you get a nice drop shadow
11961196
effect. The default is to draw with no blur.
11971197
* `:text_align` - Specify the alignment of the text you are drawing. You will
1198-
usually specify one of: `:left`, `:center`, or `:right`. You can also specify
1199-
vertical alignment. See `Scenic.Primitive.Style.TextAlign` for details.
1198+
usually specify one of: `:left`, `:center`, or `:right`. See
1199+
`Scenic.Primitive.Style.TextAlign` for details.
12001200
* `:text_height` - Specify the vertical spacing between rows of text.
12011201
12021202

0 commit comments

Comments
 (0)