3{-| Functions for displaying text
9@docs leftAligned, rightAligned, centered, justified
12@docs link, Style, style, Line, defaultStyle
14# Convenience Functions
16There are two convenience functions for creating an `Element` which can be
17useful when debugging or prototyping:
19@docs plainText, asText
21There are also a bunch of functions to set parts of a `Style` individually:
23@docs typeface, monospace, height, color, bold, italic, line
29import Color (Color, black)
30import Graphics.Element (Element, Three, Pos, ElementPrim, Properties)
31import Maybe (Maybe, Nothing)
32import JavaScript (JSString)
37data Line = Under | Over | Through
39{-| Representation of all the ways you can style `Text`.
43 , height : Maybe Float
50{-| Plain black text. It uses the browsers default typeface and text height.
51No decorations are used:
71{-| Convert a string into text which can be styled and displayed. -}
72toText : String -> Text
73toText = Native.Text.toText
75{-| Set the style of some text.
77style : Style -> Text -> Text
78style = Native.Text.style
80{-| Provide a list of prefered typefaces for some text.
82 ["helvetica","arial","sans-serif"]
84Not everyone has access to the same typefaces, so rendering will use the first
85typeface in the list that is found on the user's computer. If there are no
86matches, it will use their default typeface. Works the same as the CSS
89typeface : [String] -> Text -> Text
90typeface = Native.Text.typeface
92{-| Switch to a monospace typeface. Good for code snippets. -}
93monospace : Text -> Text
94monospace = Native.Text.monospace
98 link "http://elm-lang.org" (toText "Elm Website")
100link : String -> Text -> Text
101link = Native.Text.link
103height : Float -> Text -> Text
104height = Native.Text.height
106color : Color -> Text -> Text
107color = Native.Text.color
110bold = Native.Text.bold
113italic = Native.Text.italic
115line : Line -> Text -> Text
116line = Native.Text.line
118leftAligned : Text -> Element
119leftAligned = Native.Text.leftAligned
121rightAligned : Text -> Element
122rightAligned = Native.Text.rightAligned
124centered : Text -> Element
125centered = Native.Text.centered
127justified : Text -> Element
128justified = Native.Text.justified
130{-| Display a plain string. -}
131plainText : String -> Element
133 leftAligned (toText str)
135{-| for internal use only -}
137markdown = Native.Text.markdown
139{-| Convert anything to its textual representation and make it displayable in
142 asText == text . monospace . show
144Excellent for debugging.
148 leftAligned (monospace (toText (String.show value)))
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list