]> gitweb.factorcode.org Git - factor.git/blob - basis/colors/colors-docs.factor
Fix conflict in images vocab
[factor.git] / basis / colors / colors-docs.factor
1 IN: colors
2 USING: accessors help.markup help.syntax ;
3
4 HELP: color
5 { $class-description "The class of colors. Implementations include " { $link rgba } ", " { $vocab-link "colors.gray" } " and " { $vocab-link "colors.hsv" } "." } ;
6
7 HELP: rgba
8 { $class-description "The class of colors with red, green, blue and alpha channel components. The slots store color components, which are real numbers in the range 0 to 1, inclusive." } ;
9
10 HELP: >rgba
11 { $values { "color" color } { "rgba" rgba } }
12 { $contract "Converts a color to an RGBA color." } ;
13
14 ARTICLE: "colors.protocol" "Color protocol"
15 "Abstract superclass for colors:"
16 { $subsection color }
17 "All color objects must are required to implement a method on the " { $link >rgba } " generic word."
18 $nl
19 "Optionally, they can provide methods on the accessors " { $link red>> } ", " { $link green>> } ", " { $link blue>> } " and " { $link alpha>> } ", either by defining slots with the appropriate names, or with methods which calculate the color component values. The accessors should return color components which are real numbers in the range between 0 and 1."
20 $nl
21 "Overriding the accessors is purely an optimization, since the default implementations call " { $link >rgba } " and then extract the appropriate component of the result." ;
22
23 ARTICLE: "colors" "Colors"
24 "The " { $vocab-link "colors" } " vocabulary defines a protocol for colors, with a concrete implementation for RGBA colors. This vocabulary is used by " { $vocab-link "io.styles" } ", " { $vocab-link "ui" } " and other vocabularies, but it is independent of them."
25 $nl
26 "RGBA colors:"
27 { $subsection rgba }
28 { $subsection <rgba> }
29 "Converting a color to RGBA:"
30 { $subsection >rgba }
31 "Extracting RGBA components of colors:"
32 { $subsection >rgba-components }
33 "Further topics:"
34 { $subsection "colors.protocol" }
35 { $subsection "colors.constants" }
36 { $vocab-subsection "Grayscale colors" "colors.gray" }
37 { $vocab-subsection "HSV colors" "colors.hsv" } ;
38
39 ABOUT: "colors"