]> gitweb.factorcode.org Git - factor.git/blob - basis/help/stylesheet/stylesheet.factor
Switch to https urls
[factor.git] / basis / help / stylesheet / stylesheet.factor
1 ! Copyright (C) 2005, 2009 Slava Pestov.
2 ! See https://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 $ help-header-background }
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     { foreground $ text-color }
96     { page-color $ code-background-color }
97     { border-color $ code-border-color }
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 $ output-color }
106 } output-style set-global
107
108 SYMBOL: url-style
109 H{
110     { font-name $ default-monospace-font-name }
111     { foreground $ link-color }
112 } url-style set-global
113
114 SYMBOL: warning-style
115 H{
116     { page-color $ warning-background-color }
117     { border-color $ warning-border-color }
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 $ warning-background-color }
125     { border-color $ warning-border-color }
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 $ table-border-color }
139 } table-style set-global
140
141 SYMBOL: list-content-style
142 H{
143     { wrap-margin $ wrap-margin-list-content }
144 } list-content-style set-global
145
146 SYMBOL: list-style
147 H{
148     { table-gap { 5 5 } }
149 } list-style set-global
150
151 SYMBOL: bullet
152 "• " bullet set-global
153
154 : adjust-help-font-size ( delta -- )
155     [
156         font-size
157         {
158             default-style title-style
159             help-path-style heading-style
160             subsection-style snippet-style
161             code-style
162         }
163     ] dip '[ get-global [ _ + 1 max ] change-at ] with each ;