]> gitweb.factorcode.org Git - factor.git/blob - basis/help/stylesheet/stylesheet.factor
Replaced hard-coded colors with constants
[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 ui.gadgets.theme ;
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 $ link-color }
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 $ title-color }
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 } help-path-style set-global
65
66 SYMBOL: heading-style
67 H{
68     { font-name $ default-sans-serif-font-name }
69     { font-size $ font-size-heading }
70     { font-style bold }
71     { foreground $ heading-color }
72 } heading-style set-global
73
74 SYMBOL: subsection-style
75 H{
76     { font-name $ default-sans-serif-font-name }
77     { font-size $ font-size-subsection }
78     { font-style bold }
79 } subsection-style set-global
80
81 SYMBOL: snippet-style
82 H{
83     { font-name $ default-monospace-font-name }
84     { font-size $ default-font-size }
85     { foreground $ snippet-color }
86 } snippet-style set-global
87
88 SYMBOL: code-char-style
89 H{
90     { font-name $ default-monospace-font-name }
91     { font-size $ default-font-size }
92 } code-char-style set-global
93
94 SYMBOL: code-style
95 H{
96     { page-color $ code-background-color }
97     { inset { 5 5 } }
98     { wrap-margin f }
99 } code-style set-global
100
101 SYMBOL: output-style
102 H{
103     { font-style bold }
104     { foreground $ output-color }
105 } output-style set-global
106
107 SYMBOL: url-style
108 H{
109     { font-name $ default-monospace-font-name }
110     { foreground $ url-color }
111 } url-style set-global
112
113 SYMBOL: warning-style
114 H{
115     { page-color $ warning-background-color }
116     { inset { 5 5 } }
117     { wrap-margin $ wrap-margin-full }
118 } warning-style set-global
119
120 SYMBOL: deprecated-style
121 H{
122     { page-color $ warning-background-color }
123     { inset { 5 5 } }
124     { wrap-margin $ wrap-margin-full }
125 } deprecated-style set-global
126
127 SYMBOL: table-content-style
128 H{
129     { wrap-margin $ wrap-margin-table-content }
130 } table-content-style set-global
131
132 SYMBOL: table-style
133 H{
134     { table-gap { 5 5 } }
135     { table-border $ line-color }
136 } table-style set-global
137
138 SYMBOL: list-style
139 H{ { table-gap { 10 2 } } } list-style set-global
140
141 SYMBOL: bullet
142 "• " bullet set-global
143
144 : adjust-help-font-size ( delta -- )
145     [
146         font-size
147         {
148             default-span-style title-style
149             help-path-style heading-style
150             subsection-style snippet-style
151             code-char-style
152         }
153     ] dip '[ get-global [ _ + ] change-at ] with each ;