From 75be6df3947569f29e3af5335ca28d2981b73558 Mon Sep 17 00:00:00 2001 From: Jay Stakelon Date: Wed, 9 Aug 2017 19:21:21 -0700 Subject: [PATCH 1/3] Add fontFamily and textColor options First of all this module is awesome and thanks. I needed to customize the font family and change the color of the input text when focused, and to do so added `fontFamily` and `textColor` options. (`textColor` maps to `color` in css, I didn't want to accidentally collide with Layer's `color` option). --- input.coffee | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/input.coffee b/input.coffee index b27b84f..60ad1fb 100644 --- a/input.coffee +++ b/input.coffee @@ -96,6 +96,8 @@ class exports.Input extends Layer options.autoCapitalize ?= "on" options.spellCheck ?= "on" options.autofocus ?= false + options.textColor ?= "#000" + options.fontFamily ?= "-apple-system" super options @@ -117,6 +119,8 @@ 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.value = options.text @input.type = options.type From 55348059dac8e6b1d52a3162b00505c930976330 Mon Sep 17 00:00:00 2001 From: Jay Stakelon Date: Wed, 9 Aug 2017 20:47:30 -0700 Subject: [PATCH 2/3] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 6fac4f8..281eb71 100644 --- a/README.md +++ b/README.md @@ -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 From 5f0efc241b325f8335b3ecae364fe02cdee41183 Mon Sep 17 00:00:00 2001 From: Jay Stakelon Date: Wed, 9 Aug 2017 20:48:28 -0700 Subject: [PATCH 3/3] Add fontWeight while we're at it --- input.coffee | 2 ++ 1 file changed, 2 insertions(+) diff --git a/input.coffee b/input.coffee index 60ad1fb..2f42068 100644 --- a/input.coffee +++ b/input.coffee @@ -98,6 +98,7 @@ class exports.Input extends Layer options.autofocus ?= false options.textColor ?= "#000" options.fontFamily ?= "-apple-system" + options.fontWeight ?= "500" super options @@ -121,6 +122,7 @@ class exports.Input extends Layer @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