kewt-peacock
v0.2.1
Published
interfaces for setting, fetching, persisting, and rendering text track styling
Downloads
4
Readme
kewt
interfaces for setting, fetching, persisting, and rendering text track styling
Example
The following code loads a DOM ready interface that checks for existing settings on localstorage, sets new values for a variety of options, persists the changes to localstorage, and renders a style tag to the document head.
import { KewtDOM } from 'kewt';
KewtDOM
.set('font', 'sans-serif')
.set('fontSize', '4')
.set('fontEdge', 'shadow')
.set('edgeHighlight', 'yellow')
.set('edgeOpacity', 50)
.set('textColor', 'teal')
.set('textOpacity', 25)
.set('backgroundColor', 'purple')
.set('backgroundOpacity', '100')
.persist()
.render();
Settings
| Setting | Default | Options |
|---|---|---|
| font
| 'monospace'
| 'monospace'
, 'sans-serif'
, 'serif'
|
| fontSize
| '3'
| '1'
-'6'
|
| fontEdge
| none
| 'none'
, 'uniform'
, 'raised'
, 'shadow'
, 'depressed'
|
| edgeHighlight
| 'black'
| 'black'
, 'blue'
, 'green'
, 'teal'
, 'red'
, 'purple'
, 'yellow'
, 'white'
|
| edgeOpacity
| '0'
| '0'
-'100'
|
| textColor
| 'white'
| 'black'
, 'blue'
, 'green'
, 'teal'
, 'red'
, 'purple'
, 'yellow'
, 'white'
|
| textOpacity
| '100'
| '0'
-'100'
|
| backgroundColor
| 'black'
| 'black'
, 'blue'
, 'green'
, 'teal'
, 'red'
, 'purple'
, 'yellow'
, 'white'
|
| backgroundOpacity
| '100'
| '0'
-'100'
|
Kewt
Kind: global class
new Kewt(options, defaults)
constructor - creates a new text track interface
| Param | Type | Description | | --- | --- | --- | | options | object | overrides for default options | | defaults | object | overrides for detault defaults |
kewt.reset() ⇒ Kewt
reset - resets all caption properties to their default values
Kind: instance method of Kewt
kewt.get([property]) ⇒ string | object
get - gets the property, if specified, or all the properties
Kind: instance method of Kewt
Returns: string | object - the property, if specified, or all the properties
| Param | Type | Description | | --- | --- | --- | | [property] | string | the property to get |
kewt.set(property, [value]) ⇒ Kewt
set - sets a property or properties
Kind: instance method of Kewt
| Param | Type | Description | | --- | --- | --- | | property | string | object | the property to set | | [value] | string | the value for the property if property is a string |
kewt.setProperty(property, value) ⇒ Kewt
setProperty - sets a property
Kind: instance method of Kewt
| Param | Type | Description | | --- | --- | --- | | property | string | the property to set | | value | string | the value for the property |
KewtDOM
Kind: global class
- KewtDOM
- new KewtDOM(options, defaults)
- .reset() ⇒ undefined
- .render() ⇒ undefined
- .persist() ⇒ undefined
new KewtDOM(options, defaults)
constructor - creates a new text track interface with DOM capabilities
| Param | Type | Description | | --- | --- | --- | | options | object | overrides for default options | | defaults | object | overrides for detault defaults |
kewtDOM.reset() ⇒ undefined
reset - resets all caption properties to their default values and clears persisted state
Kind: instance method of KewtDOM
kewtDOM.render() ⇒ undefined
render - renders the style tag with styles to document head
Kind: instance method of KewtDOM
kewtDOM.persist() ⇒ undefined
persist - persists the current Kewt state to localstorage
Kind: instance method of KewtDOM
Scripts
test
– run the tests
npm run test
coverage
– generate and view code coverage as HTML
npm run coverage
lint
– lint the codebase
npm run lint
readme
– generate the README
npm run readme
compile
– compile the code
npm run compile
License
MIT @ Flip