]> gitweb.factorcode.org Git - factor.git/blob - basis/help/stylesheet/stylesheet.factor
e125b361f923a37a6a132bd0b03bf3a1a660b330
[factor.git] / basis / help / stylesheet / stylesheet.factor
1 ! Copyright (C) 2005, 2009 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: assocs colors.constants fonts fry io.styles kernel literals
4 math namespaces sequences ;
5 IN: help.stylesheet
6
7 : wrap-margin-full ( -- n )
8     42 default-font-size * ;
9
10 : wrap-margin-table-content ( -- n )
11     29 default-font-size * ;
12
13 : font-size-subsection ( -- n )
14     7/6 default-font-size * >integer ;
15
16 : font-size-title ( -- n )
17     5/3 default-font-size * >integer ;
18
19 : font-size-heading ( -- n )
20     4/3 default-font-size * >integer ;
21
22 : font-size-span ( -- n )
23     13/12 default-font-size * >integer ;
24
25 SYMBOL: default-span-style
26 H{
27     { font-name $ default-sans-serif-font-name }
28     { font-size $ font-size-span }
29     { font-style plain }
30 } default-span-style set-global
31
32 SYMBOL: default-block-style
33 H{
34     { wrap-margin $ wrap-margin-full }
35 } default-block-style set-global
36
37 SYMBOL: link-style
38 H{
39     { foreground COLOR: DodgerBlue4 }
40     { font-style bold }
41 } link-style set-global
42
43 SYMBOL: emphasis-style
44 H{ { font-style italic } } emphasis-style set-global
45
46 SYMBOL: strong-style
47 H{ { font-style bold } } strong-style set-global
48
49 SYMBOL: title-style
50 H{
51     { font-name $ default-sans-serif-font-name }
52     { font-size $ font-size-title }
53     { font-style bold }
54     { wrap-margin $ wrap-margin-full }
55     { foreground COLOR: gray20 }
56     { page-color COLOR: FactorLightTan }
57     { inset { 5 5 } }
58 } title-style set-global
59
60 SYMBOL: help-path-style
61 H{
62     { font-size $ default-font-size }
63     { table-gap { 5 5 } }
64     { table-border COLOR: FactorLightTan }
65 } help-path-style set-global
66
67 SYMBOL: heading-style
68 H{
69     { font-name $ default-sans-serif-font-name }
70     { font-size $ font-size-heading }
71     { font-style bold }
72     { foreground COLOR: FactorDarkSlateBlue }
73 } heading-style set-global
74
75 SYMBOL: subsection-style
76 H{
77     { font-name $ default-sans-serif-font-name }
78     { font-size $ font-size-subsection }
79     { font-style bold }
80 } subsection-style set-global
81
82 SYMBOL: snippet-style
83 H{
84     { font-name $ default-monospace-font-name }
85     { font-size $ default-font-size }
86     { foreground COLOR: DarkOrange4 }
87 } snippet-style set-global
88
89 SYMBOL: code-char-style
90 H{
91     { font-name $ default-monospace-font-name }
92     { font-size $ default-font-size }
93 } code-char-style set-global
94
95 SYMBOL: code-style
96 H{
97     { page-color COLOR: FactorLightTan }
98     { inset { 5 5 } }
99     { wrap-margin f }
100 } code-style set-global
101
102 SYMBOL: output-style
103 H{
104     { font-style bold }
105     { foreground COLOR: DarkOrange4 }
106 } output-style set-global
107
108 SYMBOL: url-style
109 H{
110     { font-name $ default-monospace-font-name }
111     { foreground COLOR: DodgerBlue4 }
112 } url-style set-global
113
114 SYMBOL: warning-style
115 H{
116     { page-color COLOR: gray90 }
117     { border-color COLOR: red }
118     { inset { 5 5 } }
119     { wrap-margin $ wrap-margin-full }
120 } warning-style set-global
121
122 SYMBOL: deprecated-style
123 H{
124     { page-color COLOR: gray90 }
125     { border-color COLOR: red }
126     { inset { 5 5 } }
127     { wrap-margin $ wrap-margin-full }
128 } deprecated-style set-global
129
130 SYMBOL: table-content-style
131 H{
132     { wrap-margin $ wrap-margin-table-content }
133 } table-content-style set-global
134
135 SYMBOL: table-style
136 H{
137     { table-gap { 5 5 } }
138     { table-border COLOR: FactorTan }
139 } table-style set-global
140
141 SYMBOL: list-style
142 H{ { table-gap { 10 2 } } } list-style set-global
143
144 SYMBOL: bullet
145 "• " bullet set-global
146
147 : adjust-help-font-size ( delta -- )
148     [
149         font-size
150         {
151             default-span-style title-style
152             help-path-style heading-style
153             subsection-style snippet-style
154             code-char-style
155         }
156     ] dip '[ get-global [ _ + ] change-at ] with each ;