on a268421 help sign in
elk/libraries/Text.elm
89 lines 2.1 kB history raw
2module Text where
4import open Basics
5import Color (Color)
6import Graphics.Element (Element, Three, Pos, ElementPrim, Properties)
7import Maybe (Maybe)
8import JavaScript (JSString)
9import Native.Text
11data Text = Text
13-- Convert a string into text which can be styled and displayed.
14toText : String -> Text
15toText = Native.Text.toText
17-- Set the typeface of some text. The first argument should be a comma separated listing of the desired typefaces
18-- "helvetica, arial, sans-serif"
19-- Works the same as the CSS font-family property.
20typeface : String -> Text -> Text
21typeface = Native.Text.typeface
23-- Switch to a monospace typeface. Good for code snippets.
24monospace : Text -> Text
25monospace = Native.Text.monospace
27-- Make text big and noticable.
28header : Text -> Text
29header = Native.Text.header
31-- Create a link.
32link : String -> Text -> Text
33link = Native.Text.link
35-- Set the height of text in pixels.
36height : Float -> Text -> Text
37height = Native.Text.height
39-- Set the color of a string.
40color : Color -> Text -> Text
41color = Native.Text.color
43-- Make a string bold.
44bold : Text -> Text
45bold = Native.Text.bold
47-- Italicize a string.
48italic : Text -> Text
49italic = Native.Text.italic
51-- Draw a line above a string.
52overline : Text -> Text
53overline = Native.Text.overline
55-- Underline a string.
56underline : Text -> Text
57underline = Native.Text.underline
59-- Draw a line through a string.
60strikeThrough : Text -> Text
61strikeThrough = Native.Text.strikeThrough
63-- Display justified, styled text.
64justified : Text -> Element
65justified = Native.Text.justified
67-- Display centered, styled text.
68centered : Text -> Element
69centered = Native.Text.centered
71-- Display right justified, styled text.
72righted : Text -> Element
73righted = Native.Text.righted
75-- Display styled text.
76text : Text -> Element
77text = Native.Text.text
79-- Display a plain string.
80plainText : String -> Element
81plainText = Native.Text.plainText
83-- Convert anything to it's textual representation and make it displayable in browser
84--
85-- asText == text . monospace . show
86--
87-- Excellent for debugging.
88asText : a -> Element
89asText = Native.Text.asText