Skip to content

Commit

Permalink
Merge pull request #21 from stakes/patch-1
Browse files Browse the repository at this point in the history
Add fontFamily, textColor, and fontWeight
  • Loading branch information
ajimix authored Aug 10, 2017
2 parents 0006ae6 + 5f0efc2 commit f899d81
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,12 @@ input = new InputModule.Input
placeholder: "Username" # Text visible before the user type
placeholderColor: "#fff" # Color of the placeholder text
text: "Some text" # Initial text in the input
textColor: "#000" # Color of the input text
type: "text" # Use any of the available HTML input types. Take into account that on the computer the same keyboard image will appear regarding the type used.
backgroundColor: "transparent" # e.g. "#ffffff" or "blue"
fontSize: 30 # Size in px
fontFamily: "-apple-system" # Font family for placeholder and input text
fontWeight: "500" # Font weight for placeholder and input text
lineHeight: 1 # Line height in em
padding: 10 # Padding in px, multiple values are also supported via string, e.g. "10 5 16 2"
autofocus: false # Change to true to enable autofocus
Expand Down
6 changes: 6 additions & 0 deletions input.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ class exports.Input extends Layer
options.autoCapitalize ?= "on"
options.spellCheck ?= "on"
options.autofocus ?= false
options.textColor ?= "#000"
options.fontFamily ?= "-apple-system"
options.fontWeight ?= "500"

super options

Expand All @@ -117,6 +120,9 @@ class exports.Input extends Layer
@input.style.border = "none"
@input.style.backgroundColor = options.backgroundColor
@input.style.padding = _inputStyle["padding"](@)
@input.style.fontFamily = options.fontFamily
@input.style.color = options.textColor
@input.style.fontWeight = options.fontWeight

@input.value = options.text
@input.type = options.type
Expand Down

0 comments on commit f899d81

Please sign in to comment.