on fa132ea help sign in
elk/libraries/Text.elm
88 lines 2.0 kB history raw
2module Text where
4import Color (Color)
5import Graphics.Element (Element, Three, Pos, ElementPrim, Properties)
6import Maybe (Maybe)
7import JavaScript (JSString)
8import Native.Text as Native
10data Text = Text
12-- Convert a string into text which can be styled and displayed.
13toText : String -> Text
14toText = Native.toText
16-- Set the typeface of some text. The first argument should be a comma separated listing of the desired typefaces
17-- "helvetica, arial, sans-serif"
18-- Works the same as the CSS font-family property.
19typeface : String -> Text -> Text
20typeface = Native.typeface
22-- Switch to a monospace typeface. Good for code snippets.
23monospace : Text -> Text
24monospace = Native.monospace
26-- Make text big and noticable.
27header : Text -> Text
28header = Native.header
30-- Create a link.
31link : String -> Text -> Text
32link = Native.link
34-- Set the height of text in pixels.
35height : Float -> Text -> Text
36height = Native.height
38-- Set the color of a string.
39color : Color -> Text -> Text
40color = Native.color
42-- Make a string bold.
43bold : Text -> Text
44bold = Native.bold
46-- Italicize a string.
47italic : Text -> Text
48italic = Native.italic
50-- Draw a line above a string.
51overline : Text -> Text
52overline = Native.overline
54-- Underline a string.
55underline : Text -> Text
56underline = Native.underline
58-- Draw a line through a string.
59strikeThrough : Text -> Text
60strikeThrough = Native.strikeThrough
62-- Display justified, styled text.
63justified : Text -> Element
64justified = Native.justified
66-- Display centered, styled text.
67centered : Text -> Element
68centered = Native.centered
70-- Display right justified, styled text.
71righted : Text -> Element
72righted = Native.righted
74-- Display styled text.
75text : Text -> Element
76text = Native.text
78-- Display a plain string.
79plainText : String -> Element
80plainText = Native.plainText
82-- Convert anything to it's textual representation and make it displayable in browser
83--
84-- asText == text . monospace . show
85--
86-- Excellent for debugging.
87asText : a -> Element
88asText = Native.asText