@@ -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,19 +211,18 @@ 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 """
217-
218- # import IEx
219-
225+
220226 @ g :color_g
221227 @ ga :color_ga
222228 @ rgb :color_rgb
0 commit comments