]> gitweb.factorcode.org Git - factor.git/blob - basis/help/stylesheet/stylesheet.factor
colors: merge colors.constants and colors.hex.
[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 fonts io.styles kernel literals math
4 math.order namespaces sequences ui.theme ;
5 IN: help.stylesheet
6
7 : wrap-margin-full ( -- n )
8     48 default-font-size * ;
9
10 : wrap-margin-table-content ( -- n )
11     32 default-font-size * ;
12
13 : wrap-margin-list-content ( -- n )
14     40 default-font-size * ;
15
16 : font-size-subsection ( -- n )
17     14/12 default-font-size * >integer ;
18
19 : font-size-title ( -- n )
20     20/12 default-font-size * >integer ;
21
22 : font-size-heading ( -- n )
23     16/12 default-font-size * >integer ;
24
25 : font-size-span ( -- n )
26     14/12 default-font-size * >integer ;
27
28 SYMBOL: default-style
29 H{
30     { font-name $ default-sans-serif-font-name }
31     { font-size $ font-size-span }
32     { foreground $ text-color }
33     { font-style plain }
34     { wrap-margin $ wrap-margin-full }
35 } default-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-name $ default-sans-serif-font-name }
63     { font-size $ font-size-span }
64     { font-style plain }
65     { foreground $ text-color }
66     { table-gap { 5 5 } }
67 } help-path-style set-global
68
69 SYMBOL: heading-style
70 H{
71     { font-name $ default-sans-serif-font-name }
72     { font-size $ font-size-heading }
73     { font-style bold }
74     { foreground $ heading-color }
75 } heading-style set-global
76
77 SYMBOL: subsection-style
78 H{
79     { font-name $ default-sans-serif-font-name }
80     { font-size $ font-size-subsection }
81     { font-style bold }
82 } subsection-style set-global
83
84 SYMBOL: snippet-style
85 H{
86     { font-name $ default-monospace-font-name }
87     { font-size $ default-font-size }
88     { foreground $ snippet-color }
89 } snippet-style set-global
90
91 SYMBOL: code-style
92 H{
93     { font-name $ default-monospace-font-name }
94     { font-size $ default-font-size }
95     { page-color $ code-background-color }
96     { inset { 5 5 } }
97     { wrap-margin f }
98 } code-style set-global
99
100 SYMBOL: output-style
101 H{
102     { font-style bold }
103     { foreground $ output-color }
104 } output-style set-global
105
106 SYMBOL: url-style
107 H{
108     { font-name $ default-monospace-font-name }
109     { foreground $ link-color }
110 } url-style set-global
111
112 SYMBOL: warning-style
113 H{
114     { page-color $ warning-background-color }
115     { border-color $ warning-border-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     { border-color $ warning-border-color }
124     { inset { 5 5 } }
125     { wrap-margin $ wrap-margin-full }
126 } deprecated-style set-global
127
128 SYMBOL: table-content-style
129 H{
130     { wrap-margin $ wrap-margin-table-content }
131 } table-content-style set-global
132
133 SYMBOL: table-style
134 H{
135     { table-gap { 5 5 } }
136     { table-border $ table-border-color }
137 } table-style set-global
138
139 SYMBOL: list-content-style
140 H{
141     { wrap-margin $ wrap-margin-list-content }
142 } list-content-style set-global
143
144 SYMBOL: list-style
145 H{
146     { table-gap { 5 5 } }
147 } list-style set-global
148
149 SYMBOL: bullet
150 "• " bullet set-global
151
152 : adjust-help-font-size ( delta -- )
153     [
154         font-size
155         {
156             default-style title-style
157             help-path-style heading-style
158             subsection-style snippet-style
159             code-style
160         }
161     ] dip '[ get-global [ _ + 1 max ] change-at ] with each ;