]> gitweb.factorcode.org Git - factor.git/blob - basis/colors/colors-docs.factor
95c9782aa7859e33528ff3aa940cd900224ab33c
[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 { $subsections color }
17 "All color objects 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 with floating point components in the range " { $snippet "[0,1]" } ":"
27 { $subsections
28     rgba
29     <rgba>
30 }
31 "Converting a color to RGBA:"
32 { $subsections >rgba }
33 "Extracting RGBA components of colors:"
34 { $subsections >rgba-components }
35 "Further topics:"
36 { $subsections
37     "colors.protocol"
38     "colors.constants"
39 }
40 "Color implementations:"
41 { $vocab-subsection "CIE 1931 XYZ colors" "colors.xyz" }
42 { $vocab-subsection "CIE 1931 xyY colors" "colors.xyy" }
43 { $vocab-subsection "CIE 1976 LAB colors" "colors.lab" }
44 { $vocab-subsection "CIE 1976 LUV colors" "colors.luv" }
45 { $vocab-subsection "CMYK colors" "colors.cmyk" }
46 { $vocab-subsection "Grayscale colors" "colors.gray" }
47 { $vocab-subsection "HSL colors" "colors.hsl" }
48 { $vocab-subsection "HSV colors" "colors.hsv" }
49 { $vocab-subsection "RYB colors" "colors.ryb" }
50 { $vocab-subsection "YIQ colors" "colors.yiq" }
51 { $vocab-subsection "YUV colors" "colors.yuv" } ;
52
53 ABOUT: "colors"